Exemple #1
0
        public static Vertex CreateVertex(Vector3D v)
        {
            Vertex vert = new Vertex(IDCounter.ClaimID());

            vert.Position = v;
            return(vert);
        }
Exemple #2
0
        // Face creating methods
        public static QuadFace CreateFace(Vertex v1, Vertex v2, Vertex v3, Vertex v4, Edge e1, Edge e2, Edge e3, Edge e4)
        {
            QuadFace face = new QuadFace(IDCounter.ClaimID());

            face.Vertex1 = v1;
            v1.Faces.Add(face);
            face.Vertex2 = v2;
            v2.Faces.Add(face);
            face.Vertex3 = v3;
            v3.Faces.Add(face);
            face.Vertex4 = v4;
            v4.Faces.Add(face);
            face.Edge1 = e1;
            e1.Faces.Add(face);
            face.Edge2 = e2;
            e2.Faces.Add(face);
            face.Edge3 = e3;
            e3.Faces.Add(face);
            face.Edge4 = e4;
            e4.Faces.Add(face);
            face.CalculateCenter();
            face.CalculatePerimeter();
            face.CalculateArea();

            return(face);
        }
Exemple #3
0
        // Edge creating methods
        public static Edge CreateEdge(Vertex v1, Vertex v2)
        {
            Edge edge = new Edge(IDCounter.ClaimID());

            edge.Vertex1 = v1;
            edge.Vertex2 = v2;
            v1.Edges.Add(edge);
            v1.Connections.Add(v2);
            v2.Edges.Add(edge);
            v2.Connections.Add(v1);
            edge.CalculateCenter();
            edge.CalculateLength();
            return(edge);
        }
Exemple #4
0
        // Face creating methods
        public static TriFace CreateFace(Vertex v1, Vertex v2, Vertex v3, Edge e1, Edge e2, Edge e3)
        {
            TriFace face = new TriFace(IDCounter.ClaimID());

            face.Vertex1 = v1;
            v1.Faces.Add(face);
            face.Vertex2 = v2;
            v2.Faces.Add(face);
            face.Vertex3 = v3;
            v3.Faces.Add(face);
            face.Edge1 = e1;
            e1.Faces.Add(face);
            face.Edge2 = e2;
            e2.Faces.Add(face);
            face.Edge3 = e3;
            e3.Faces.Add(face);
            face.CalculateCenter();
            face.CalculatePerimeter();
            face.CalculateArea();

            return(face);
        }
Exemple #5
0
        public static HexVolume CreateVolume(Vertex v1, Vertex v2, Vertex v3, Vertex v4, Vertex v5, Vertex v6, Vertex v7, Vertex v8)
        {
            HexVolume vol = new HexVolume(IDCounter.ClaimID());

            return(vol);
        }
Exemple #6
0
        public static PyramidVolume CreateVolume(TriFace f1, TriFace f2, TriFace f3, TriFace f4, QuadFace f5)
        {
            PyramidVolume vol = new PyramidVolume(IDCounter.ClaimID());

            List <Face> faces = new List <Face>()
            {
                f1, f2, f3, f4, f5
            };
            List <Edge>   edges    = new List <Edge>();
            List <Vertex> vertices = new List <Vertex>();

            foreach (Face f in faces)
            {
                if (vol.Face1 == null && f is TriFace)
                {
                    vol.Face1 = f as TriFace;
                }
                else if (vol.Face2 == null && f is TriFace)
                {
                    vol.Face2 = f as TriFace;
                }
                else if (vol.Face3 == null && f is TriFace)
                {
                    vol.Face3 = f as TriFace;
                }
                else if (vol.Face4 == null && f is TriFace)
                {
                    vol.Face4 = f as TriFace;
                }
                else if (vol.Face5 == null && f is QuadFace)
                {
                    vol.Face5 = f as QuadFace;
                }
                else
                {
                    Console.WriteLine("Error during volume #" + vol.ID + "creation: Not expected face type.");
                }

                if (f.Volume1 == null)
                {
                    f.Volume1 = vol;
                }
                else if (f.Volume2 == null)
                {
                    f.Volume2 = vol;
                }
                else
                {
                    Console.WriteLine("Error during volume #" + vol.ID + "creation: Face #" + f.ID + " already has");
                }

                if (f is TriFace)
                {
                    if (!edges.Contains((f as TriFace).Edge1))
                    {
                        edges.Add((f as TriFace).Edge1);
                    }
                    if (!edges.Contains((f as TriFace).Edge2))
                    {
                        edges.Add((f as TriFace).Edge2);
                    }
                    if (!edges.Contains((f as TriFace).Edge3))
                    {
                        edges.Add((f as TriFace).Edge3);
                    }
                    if (!vertices.Contains((f as TriFace).Vertex1))
                    {
                        vertices.Add((f as TriFace).Vertex1);
                    }
                    if (!vertices.Contains((f as TriFace).Vertex2))
                    {
                        vertices.Add((f as TriFace).Vertex2);
                    }
                    if (!vertices.Contains((f as TriFace).Vertex3))
                    {
                        vertices.Add((f as TriFace).Vertex3);
                    }
                }

                if (f is QuadFace)
                {
                    if (!edges.Contains((f as QuadFace).Edge1))
                    {
                        edges.Add((f as QuadFace).Edge1);
                    }
                    if (!edges.Contains((f as QuadFace).Edge2))
                    {
                        edges.Add((f as QuadFace).Edge2);
                    }
                    if (!edges.Contains((f as QuadFace).Edge3))
                    {
                        edges.Add((f as QuadFace).Edge3);
                    }
                    if (!edges.Contains((f as QuadFace).Edge4))
                    {
                        edges.Add((f as QuadFace).Edge4);
                    }
                    if (!vertices.Contains((f as QuadFace).Vertex1))
                    {
                        vertices.Add((f as QuadFace).Vertex1);
                    }
                    if (!vertices.Contains((f as QuadFace).Vertex2))
                    {
                        vertices.Add((f as QuadFace).Vertex2);
                    }
                    if (!vertices.Contains((f as QuadFace).Vertex3))
                    {
                        vertices.Add((f as QuadFace).Vertex3);
                    }
                    if (!vertices.Contains((f as QuadFace).Vertex4))
                    {
                        vertices.Add((f as QuadFace).Vertex4);
                    }
                }
            }

            vol.Vertex1 = vertices[0];
            if (!vol.Vertex1.Volumes.Contains(vol))
            {
                vol.Vertex1.Volumes.Add(vol);
            }
            vol.Vertex2 = vertices[1];
            if (!vol.Vertex2.Volumes.Contains(vol))
            {
                vol.Vertex2.Volumes.Add(vol);
            }
            vol.Vertex3 = vertices[2];
            if (!vol.Vertex3.Volumes.Contains(vol))
            {
                vol.Vertex3.Volumes.Add(vol);
            }
            vol.Vertex4 = vertices[3];
            if (!vol.Vertex4.Volumes.Contains(vol))
            {
                vol.Vertex4.Volumes.Add(vol);
            }
            vol.Vertex5 = vertices[4];
            if (!vol.Vertex5.Volumes.Contains(vol))
            {
                vol.Vertex5.Volumes.Add(vol);
            }

            vol.Edge1 = edges[0];
            if (!vol.Edge1.Volumes.Contains(vol))
            {
                vol.Edge1.Volumes.Add(vol);
            }
            vol.Edge2 = edges[1];
            if (!vol.Edge2.Volumes.Contains(vol))
            {
                vol.Edge2.Volumes.Add(vol);
            }
            vol.Edge3 = edges[2];
            if (!vol.Edge3.Volumes.Contains(vol))
            {
                vol.Edge3.Volumes.Add(vol);
            }
            vol.Edge4 = edges[3];
            if (!vol.Edge4.Volumes.Contains(vol))
            {
                vol.Edge4.Volumes.Add(vol);
            }
            vol.Edge5 = edges[4];
            if (!vol.Edge5.Volumes.Contains(vol))
            {
                vol.Edge5.Volumes.Add(vol);
            }
            vol.Edge6 = edges[5];
            if (!vol.Edge6.Volumes.Contains(vol))
            {
                vol.Edge6.Volumes.Add(vol);
            }
            vol.Edge7 = edges[6];
            if (!vol.Edge7.Volumes.Contains(vol))
            {
                vol.Edge7.Volumes.Add(vol);
            }
            vol.Edge8 = edges[7];
            if (!vol.Edge8.Volumes.Contains(vol))
            {
                vol.Edge8.Volumes.Add(vol);
            }

            vol.CalculateCenter();
            vol.CalculateSurface();
            vol.CalculateVolume();

            return(vol);
        }
Exemple #7
0
        public static PyramidVolume CreateVolume(Vertex v1, Vertex v2, Vertex v3, Vertex v4, Vertex v5)
        {
            PyramidVolume vol = new PyramidVolume(IDCounter.ClaimID());

            return(vol);
        }
Exemple #8
0
        public static WedgeVolume CreateVolume(Vertex v1, Vertex v2, Vertex v3, Vertex v4, Vertex v5, Vertex v6)
        {
            WedgeVolume vol = new WedgeVolume(IDCounter.ClaimID());

            return(vol);
        }