예제 #1
0
 public Int32 Add(Vertex vertex)
 {
     Int32 C = Count;
     Count++;
     m_Items[C] = vertex;
     return C;
 }
예제 #2
0
파일: Line.cs 프로젝트: stdcallua/Robots
 public Vertex Proj2d(Vertex v)
 {
     double vx = (v.X - Point.X);
     double vy = (v.Y - Point.Y);
     double bq = (Direction.X * vx + Direction.Y * vy) / ((Direction.X * Direction.X) + (Direction.Y * Direction.Y));
     return new Vertex(Point.X + bq * Direction.X, Point.Y + bq * Direction.Y, Point.Z + bq * Direction.Z);
 }
예제 #3
0
파일: Circle.cs 프로젝트: stdcallua/Robots
 public Circle(Double radius, Int32 PointCount): base(PointCount)
 {
     m_Radius = radius;
     Double AngleStep = 2*Math.PI / PointCount;
     Double Angle = 0;
     for (Int32 i = 0; i < PointCount; i++)
     {
         this[i] = new Vertex(Radius * Math.Cos(Angle), Radius * Math.Sin(Angle));
         Angle += AngleStep;
     }
 }
예제 #4
0
파일: Line.cs 프로젝트: stdcallua/Robots
 public Boolean Cross2d(Line L, ref Vertex Res)
 {
     Vertex d1 = new Vertex(Direction.X, Direction.Y);
     Vertex d2 = new Vertex(-L.Direction.X, -L.Direction.Y);
     Double Dv = d2.Y * d1.X - d2.X * d1.Y;
     if (Math.Abs(Dv) < Eps * Eps) return false;
     Double Ml = (d2.Y * (L.Point.X - Point.X) - d2.X * (L.Point.Y - Point.Y)) / Dv;
     Res = new Vertex();
     Res.X = Point.X + d1.X * Ml;
     Res.Y = Point.Y + d1.Y * Ml;
     Res.Z = Point.Z + Direction.Z * Ml;
     return true;
 }
예제 #5
0
파일: Vertex.cs 프로젝트: stdcallua/Robots
 public Vertex RotateZ(Double Angle)
 { 
     Double S = Math.Sin(Angle);
     Double C = Math.Cos(Angle);
     Vertex Result = new Vertex();  
     Result.X =  X * C + Y * S;
     Result.Y = -X * S + Y * C;
     Result.Z =  Z;
     return Result;
 }
예제 #6
0
파일: Vertex.cs 프로젝트: stdcallua/Robots
 public Double LengthTo(Vertex V)
 {
     return (this - V).Length();
 }
예제 #7
0
파일: Vertex.cs 프로젝트: stdcallua/Robots
        //опрераторы

        public Boolean Equal(Vertex V)
        { 
            Double eps = 0.01;
            return ((Math.Abs(X - V.X)<eps)&((Math.Abs(Y - V.Y)<eps)));
        }
예제 #8
0
 public Vertexes Offset(Double Dist)
 {
     Vertexes Result = new Vertexes();
     Line PrevLine = null;
     for (Int32 i = 0; i < Count; i++)
     {
         Line Line = null;
         if (i == Count - 1)
         {
             Vertex Vector = (this[i] - this[i-1]).Normalize();
             Vector = Vector.RotateZ(Math.PI / 2) * Dist;
             Result.Add(this[i] + Vector);
             break;
         }
         if (i == 0)
         {
             Vertex Vector = (this[i + 1] - this[i]).Normalize();
             Vector = Vector.RotateZ(Math.PI/2) * Dist;
             Result.Add(this[i] + Vector);
             Line = new Line((this[i + 1] - this[i]).Normalize(), this[i] + Vector);
         }
         else
         {
             Vertex Vector = (this[i + 1] - this[i]).Normalize();
             Vector = Vector.RotateZ(Math.PI / 2) * Dist;
             Line = new Line((this[i + 1] - this[i]).Normalize(), this[i] + Vector);
             Vertex point = new Vertex();
             if (Line.Cross2d(PrevLine, ref point))
             {
                 Result.Add(point);
             }
         }
         PrevLine = new Line(Line.Direction, Line.Point);
     }
     return Result;
 }
예제 #9
0
파일: Line.cs 프로젝트: stdcallua/Robots
 public Line(Vertex direction, Vertex point)
 {
     Direction = direction;
     Point = point;
 }
예제 #10
0
파일: Rect.cs 프로젝트: stdcallua/Robots
 public Rect(Vertex a, Vertex b)
 {
     A = a;
     B = b;
 }
예제 #11
0
파일: Rect.cs 프로젝트: stdcallua/Robots
 public Boolean VertexIn(Vertex V)
 {
     return ((A.X <= V.X) & (B.X >= V.X) & (A.Y >= V.Y) & (B.Y <= V.Y));
 }