예제 #1
0
파일: Polygon.cs 프로젝트: cjsatuforc/eakit
 public void Translate(Vector3 v)
 {
     for (int index = 0; index < vertices.Length; index++)
     {
         vertices[index] = new Vector3Ext(Vector3.Add(vertices[index].Position, v));
     }
 }
예제 #2
0
 public TriangleExt(Vector3 v1, Vector3 v2, Vector3 v3)
 {
     vertices     = new Vector3Ext[3];
     this.vertex1 = new Vector3Ext(v1);
     this.vertex2 = new Vector3Ext(v2);
     this.vertex3 = new Vector3Ext(v3);
 }
예제 #3
0
        public void AddMesh(MeshIndexed sourceMesh, Color color)
        {
            int vertIndex = Vertices.Count;

            foreach (Vector3Ext point in sourceMesh.Vertices)
            {
                //
                Vector3Ext vector = new Vector3Ext(point.Position);

                vector.Position = Mult(ref rotationMatrix, point.Position);
                Vertices.Add(vector);
            }

            foreach (GlPolyIndex poly in sourceMesh.Polygons)
            {
                GlPolyIndex polyIndex = new GlPolyIndex();

                polyIndex.PointIndex = new int[poly.VertexCount];
                for (int j = 0; j < poly.VertexCount; j++)
                {
                    polyIndex.PointIndex[j] = vertIndex + poly.PointIndex[j];
                }

                if (poly.Attributes.HasColor)
                {
                    polyIndex.Attributes.Color = poly.Attributes.Color;
                }
                else
                {
                    polyIndex.Attributes.Color = color;
                }

                Polygons.Add(polyIndex);
            }
        }
예제 #4
0
 public TriangleExt(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
 {
     vertices              = new Vector3Ext[3];
     this.vertex1          = new Vector3Ext(v1);
     this.vertex2          = new Vector3Ext(v2);
     this.vertex3          = new Vector3Ext(v3);
     this.Attributes.Color = color;
 }
예제 #5
0
파일: Polygon.cs 프로젝트: cjsatuforc/eakit
        public void ReverseOrder()
        {
            Vector3Ext[] new_vert = new Vector3Ext[vertices.Length];

            for (int j = 0; j < vertices.Length; j++)
            {
                new_vert[vertices.Length - 1 - j] = vertices[j];
            }

            vertices = new_vert;
        }
예제 #6
0
파일: Polygon.cs 프로젝트: cjsatuforc/eakit
        public virtual void RotateY(float angle)
        {
            double ang = Math.PI * angle / 180;

            for (int index = 0; index < vertices.Length; index++)
            {
                vertices[index] = new Vector3Ext(
                    (float)(vertices[index].Position.X * Math.Cos(ang) + vertices[index].Position.Z * Math.Sin(ang)),
                    vertices[index].Position.Y,
                    (float)(-vertices[index].Position.X * Math.Sin(ang) + vertices[index].Position.Z * Math.Cos(ang))
                    );
            }
        }
예제 #7
0
        public void AddFacet(Facet facet)
        {
            int         vertIndex = Vertices.Count;
            GlPolyIndex polyIndex = new GlPolyIndex();

            foreach (Point3DF point in facet.Points)
            {
                //
                Vector3Ext vector = new Vector3Ext(point);

                vector.Position = Mult(ref rotationMatrix, point);
                Vertices.Add(vector);
            }

            polyIndex.PointIndex = new int[facet.Points.Length];
            for (int j = 0; j < facet.Points.Length; j++)
            {
                polyIndex.PointIndex[j] = vertIndex + j;
            }

            Polygons.Add(polyIndex);
        }
예제 #8
0
 public Vector3Ext(Vector3Ext vector, Color color)
 {
     this.Position         = vector.Position;
     this.Attributes       = new Attributes();
     this.Attributes.Color = color;
 }
예제 #9
0
 //
 public Vector3Ext(Vector3Ext vector)
 {
     this.Position   = vector.Position;
     this.Attributes = new Attributes();
 }
예제 #10
0
 //
 public TriangleExt()
 {
     vertices = new Vector3Ext[3];
 }