Exemplo n.º 1
0
        public void RemoveCapWithSplit()
        {
            int count = 0;

            do
            {
                count = 0;
                for (int i = 0; i < this.mesh.HalfEdges.Count; i++)
                {
                    TriMesh.HalfEdge hf    = this.mesh.HalfEdges[i];
                    double           angle = TriMeshUtil.ComputeAngle(hf) / Math.PI * 180;
                    if (angle > this.capAngle)
                    {
                        Plane plane = this.GetPlane(hf);

                        Nullable <Vector3D> point = this.Intersect(plane, hf.Edge);
                        this.ShowIntersect(plane);

                        if (point != null)
                        {
                            this.Cut(hf, point.Value);
                            count++;
                        }
                        else
                        {
                            hf.Edge.Traits.SelectedFlag = 1;
                        }
                    }
                }
            } while (count != 0);
        }
Exemplo n.º 2
0
        public static Vector3D ComputeNormalTipAngleWeight(TriMesh.Vertex v, Vector3D[] faceNormal)
        {
            Vector3D normal = Vector3D.Zero;

            foreach (var hf in v.HalfEdges)
            {
                if (hf.Face != null)
                {
                    double angle = TriMeshUtil.ComputeAngle(hf.Next);
                    normal += angle * faceNormal[hf.Face.Index];
                }
            }
            return(normal.Normalize());
        }
Exemplo n.º 3
0
        public void Show()
        {
            TriMeshUtil.ClearMeshColor(this.mesh);
            int count = 0;

            foreach (var hf in this.mesh.HalfEdges)
            {
                double angle = TriMeshUtil.ComputeAngle(hf) / Math.PI * 180;
                if (hf.Face != null && angle > this.capAngle)
                {
                    this.SelectAngle(hf);
                    count++;
                }
            }
        }
Exemplo n.º 4
0
        public void RemoveCapWithPlane()
        {
            int count = this.mesh.HalfEdges.Count;

            for (int i = 0; i < count; i++)
            {
                TriMesh.HalfEdge hf    = this.mesh.HalfEdges[i];
                double           angle = TriMeshUtil.ComputeAngle(hf) / Math.PI * 180;
                if (angle > this.capAngle)
                {
                    Plane plane = this.GetPlane(hf);
                    this.ShowIntersect(plane);
                    this.PlaneCut(hf, plane.Normal, this.capAngle - 90);
                }
            }
        }