当前位置: 首页>>代码示例>>C#>>正文


C# Vector2f.Sub方法代码示例

本文整理汇总了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;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:15,代码来源:PRodJoint.cs

示例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);
	
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:16,代码来源:Line.cs

示例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;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:18,代码来源:PSpringJoint.cs

示例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;
		}
开发者ID:keppelcao,项目名称:LGame,代码行数:21,代码来源:Circle.cs


注:本文中的Loon.Core.Geom.Vector2f.Sub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。