本文整理汇总了C#中Loon.Core.Geom.Vector2f.Sub方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2f.Sub方法的具体用法?C# Vector2f.Sub怎么用?C# Vector2f.Sub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loon.Core.Geom.Vector2f
的用法示例。
在下文中一共展示了Vector2f.Sub方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PRodJoint
public PRodJoint(PBody b1_0, PBody b2_1, float rel1x, float rel1y, float rel2x,
float rel2y, float distance) {
this.b1 = b1_0;
this.b2 = b2_1;
localAnchor1 = new Vector2f(rel1x, rel1y);
localAnchor2 = new Vector2f(rel2x, rel2y);
b1_0.mAng.Transpose().MulEqual(localAnchor1);
b2_1.mAng.Transpose().MulEqual(localAnchor2);
dist = distance;
anchor1 = b1_0.mAng.Mul(localAnchor1).Add(b1_0.pos);
anchor2 = b2_1.mAng.Mul(localAnchor2).Add(b2_1.pos);
normal = anchor1.Sub(anchor2);
normal.Normalize();
type = Physics.PJointType.ROD_JOINT;
}
示例2: Set
public void Set(Vector2f start_0, Vector2f end_1) {
base.pointsDirty = true;
if (this.start == null) {
this.start = new Vector2f();
}
this.start.Set(start_0);
if (this.end == null) {
this.end = new Vector2f();
}
this.end.Set(end_1);
vec = new Vector2f(end_1);
vec.Sub(start_0);
}
示例3: PSpringJoint
public PSpringJoint(PBody b1_0, PBody i_2, float rel1x, float rel1y,
float rel2x, float rel2y, float distance, float strength,
float damping) {
this.b1 = b1_0;
this.b2 = i_2;
str = strength;
damp = damping;
localAnchor1 = new Vector2f(rel1x, rel1y);
localAnchor2 = new Vector2f(rel2x, rel2y);
b1_0.mAng.Transpose().MulEqual(localAnchor1);
i_2.mAng.Transpose().MulEqual(localAnchor2);
dist = distance;
anchor1 = b1_0.mAng.Mul(localAnchor1).Add(b1_0.pos);
anchor2 = i_2.mAng.Mul(localAnchor2).Add(i_2.pos);
normal = anchor1.Sub(anchor2);
normal.Normalize();
type = Physics.PJointType.SPRING_JOINT;
}
示例4: Intersects
public bool Intersects(Line other) {
Vector2f lineSegmentStart = new Vector2f(other.GetX1(), other.GetY1());
Vector2f lineSegmentEnd = new Vector2f(other.GetX2(), other.GetY2());
Vector2f circleCenter = new Vector2f(GetCenterX(), GetCenterY());
Vector2f closest;
Vector2f segv = lineSegmentEnd.Sub(lineSegmentStart);
Vector2f ptv = circleCenter.Sub(lineSegmentStart);
float segvLength = segv.Len();
float projvl = ptv.Dot(segv) / segvLength;
if (projvl < 0) {
closest = lineSegmentStart;
} else if (projvl > segvLength) {
closest = lineSegmentEnd;
} else {
Vector2f projv = segv.Mul(projvl / segvLength);
closest = lineSegmentStart.Add(projv);
}
bool intersects = circleCenter.Sub(closest).LengthSquared() <= GetRadius()
* GetRadius();
return intersects;
}