Beispiel #1
0
        // 三角形から作成
        public static Centroid Create(Vector3d p0, Vector3d p1, Vector3d p2)
        {
            Centroid ret = default(Centroid);

            ret.set(p0, p1, p2);
            return(ret);
        }
Beispiel #2
0
        public override Centroid GetCentroid()
        {
            Centroid cent = default;
            Centroid ct   = default;

            for (int i = 0; i < mHeModel.FaceStore.Count; i++)
            {
                HeFace f = mHeModel.FaceStore[i];

                HalfEdge head = f.Head;

                HalfEdge he = head;

                int i0 = he.Vertex;
                int i1 = he.Next.Vertex;
                int i2 = he.Next.Next.Vertex;

                ct.set(
                    mHeModel.VertexStore[i0].vector,
                    mHeModel.VertexStore[i1].vector,
                    mHeModel.VertexStore[i2].vector
                    );

                cent = cent.Merge(ct);
            }

            return(cent);
        }