Beispiel #1
0
        public Triangle(long id, Vertex v0, Vertex v1, Vertex v2)
        {
            ID = id;

            V0 = v0;
            V1 = v1;
            V2 = v2;

            Vertices[0] = v0;
            if (!v0.Triangles.Contains(this))
                v0.Triangles.Add(this);
            Vertices[1] = v1;
            if (!v1.Triangles.Contains(this))
                v1.Triangles.Add(this);
            Vertices[2] = v2;
            if (!v2.Triangles.Contains(this))
                v2.Triangles.Add(this);

            UpdateNormal();
            UpdateVolumeNormal();
        }
Beispiel #2
0
 public Edge(Vertex source, Vertex target)
 {
     Source = source;
     Target = target;
 }
Beispiel #3
0
        public void UpdateProcessedGeometry(float offset)
        {
            ProcessedTriangles = new List<Triangle>(Triangles.Count);
            ProcessedTriangleMapping.Clear();

            foreach (Triangle t in Triangles)
            {
                Vertex IV0 = new Vertex(t.Vertices[0].Position + t.Vertices[0].SmoothNormal * offset, new Vector3());
                Vertex IV1 = new Vertex(t.Vertices[1].Position + t.Vertices[1].SmoothNormal * offset, new Vector3());
                Vertex IV2 = new Vertex(t.Vertices[2].Position + t.Vertices[2].SmoothNormal * offset, new Vector3());

                Triangle IT = new Triangle(t.ID, IV0, IV1, IV2)
                {
                    IsVisible = t.IsVisible,
                    Patch = t.Patch
                };

                ProcessedTriangles.Add(IT);

                ProcessedTriangleMapping.Add(IT, t);
            }
        }