Beispiel #1
0
            /// <summary>
            ///
            /// </summary>
            /// <typeparam name="TV"></typeparam>
            /// <typeparam name="TE"></typeparam>
            /// <typeparam name="TF"></typeparam>
            /// <param name="mesh"></param>
            /// <param name="target"></param>
            /// <param name="features"></param>
            /// <param name="tolerance"></param>
            /// <returns></returns>
            public static Solver Create <TV, TE, TF>(HeMeshBase <TV, TE, TF> mesh, MeshFeature target, IEnumerable <IFeature> features, double tolerance = 1.0e-4)
                where TV : HeMeshBase <TV, TE, TF> .Vertex, IVertex3d
                where TE : HeMeshBase <TV, TE, TF> .Halfedge
                where TF : HeMeshBase <TV, TE, TF> .Face
            {
                var copy = HeMesh.Factory.CreateCopy(mesh, (v0, v1) => v0.Position = v1.Position, delegate { }, delegate { });

                return(new Solver(copy, target, features, tolerance));
            }
Beispiel #2
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="mesh"></param>
            /// <param name="target"></param>
            /// <param name="features"></param>
            /// <param name="tolerance"></param>
            public Solver(HeMesh mesh, MeshFeature target, IEnumerable <IFeature> features, double tolerance = 1.0e-4)
            {
                mesh.Compact();

                _mesh      = mesh;
                _verts     = _mesh.Vertices;
                _hedges    = _mesh.Halfedges;
                _settings  = new Settings();
                _stepCount = 0;

                Target = target;
                InitFeatures(features, tolerance);

                // start on features
                ProjectToFeatures();
            }
Beispiel #3
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="mesh"></param>
            /// <param name="target"></param>
            /// <param name="features"></param>
            /// <param name="tolerance"></param>
            public Solver(HeMesh mesh, MeshFeature target, IEnumerable <IFeature> features, Settings settings = null, double tolerance = _tolerance)
            {
                _mesh = mesh;
                _mesh.Compact();

                // triangulate all faces starting with the shortest diagonal
                _mesh.TriangulateFaces(FaceTriangulators.Strip.CreateFromMin(mesh, he =>
                {
                    var p0 = he.Start.Position;
                    var p1 = he.NextInFace.End.Position;
                    return(p0.SquareDistanceTo(p1));
                }));

                // initialize features
                _target = target;
                InitFeatures(features, tolerance);

                _settings  = settings ?? new Settings();
                _stepCount = 0;
            }