示例#1
0
 public static Vector2 ClosestPointOnLine1P(
     LineParametric line,
     Vector2 point,
     bool segmentClamp)
 {
     return ClosestPointOnLine1P(line.a, line.b, point, segmentClamp);
 }
 public override void Initialize()
 {
     this._windowCenter = new Vector2(this.Game.Window.ClientBounds.Width / 2, this.Game.Window.ClientBounds.Height / 2);
     this._xAxis = new LineParametric(this._windowCenter, this._windowCenter + new Vector2(1.0f, 0.0f));
     this._yAxis = new LineParametric(this._windowCenter, this._windowCenter + new Vector2(0.0f, 1.0f));
     this._spriteBatch = new SpriteBatch(this.Game.GraphicsDevice);
     this._whiteTex = new Texture2D(this.Game.GraphicsDevice, 1, 1);
     this._whiteTex.SetData(new Color[] { Color.White });
     this._destRect = new Rectangle();
     base.Initialize();
 }
示例#3
0
        public static SegmentParametric GetParametricProjection(
            LineParametric line,
            List<Vector2> vertices)
        {
            PointParametric max = new PointParametric(line, -999999);
            PointParametric min = new PointParametric(line, 999999);
            PointParametric tempPoint;

            foreach (Vector2 vertex in vertices)
            {
                tempPoint = line.GetProjectionPoint(vertex);
                if (tempPoint.T > max.T)
                {
                    max = tempPoint;
                }
                else if (tempPoint.T < min.T)
                {
                    min = tempPoint;
                }
            }

            return new SegmentParametric(line, min.T, max.T);
        }
示例#4
0
 public SegmentParametric(LineParametric line, float t1, float t2)
 {
     this.Line = line;
     this.T1 = t1;
     this.T2 = t2;
 }
示例#5
0
 public PointParametric(LineParametric line, float t)
 {
     this.Line = line;
     this.T = t;
 }