Ejemplo n.º 1
0
        public MeshGeometry3D GenerateMold(double resolution, List <MeshGeometry3D> airholes)
        {
            //generates the outer mold and interior cavity for the bolus
            var    mold = new BolusMold(_displayMesh, resolution, true);
            DMesh3 mesh = MeshGeometryToDMesh(mold.Mesh);

            //generate the airholes for boolean subtraction

            if (airholes.Count > 0)
            {
                DMesh3     booleanMesh = new DMesh3();
                var        holes       = new DMesh3();
                MeshEditor editor      = new MeshEditor(holes);
                foreach (MeshGeometry3D m in airholes)
                {
                    editor.AppendMesh(MeshGeometryToDMesh(m));
                }

                booleanMesh = holes;

                //boolean subtract the airholes from the mold
                _moldMesh = new List <DMesh3>()
                {
                    BooleanSubtraction(mesh, holes)
                };
            }

            return(DMeshToMeshGeometry(_moldMesh[0]));
        }
Ejemplo n.º 2
0
        public List <MeshGeometry3D> GenerateMold(double resolution, List <MeshGeometry3D> airholes, List <double> z_slices)
        {
            //merges airholes and bolus mesh for subtraction later
            var bolus = new DMesh3();

            if (airholes.Count > 0)
            {
                //airholes
                var        holes  = new DMesh3();
                MeshEditor editor = new MeshEditor(holes);
                foreach (MeshGeometry3D m in airholes)
                {
                    editor.AppendMesh(MeshGeometryToDMesh(m));
                }


                //boolean union the airholes and the bolus
                if (_smoothMesh != null)
                {
                    bolus = BooleanUnion(_smoothMesh, holes);
                }
                else
                {
                    bolus = BooleanUnion(_mesh, holes);
                }
            }
            else
            if (_smoothMesh != null)
            {
                bolus = _smoothMesh;
            }
            else
            {
                bolus = _mesh;
            }

            //generates the outer mold and interior cavity for the bolus
            var _molds = new List <MeshGeometry3D>();

            _moldMesh = new List <DMesh3>();
            var molds = new BolusMold(_displayMesh, resolution, z_slices).Meshes;

            //subtract the bolus from the mold
            for (int i = 0; i <= z_slices.Count; i++)
            {
                _moldMesh.Add(BooleanSubtraction(MeshGeometryToDMesh(molds[i]), bolus));
                _molds.Add(DMeshToMeshGeometry(_moldMesh[i]));
            }

            return(_molds);
        }
Ejemplo n.º 3
0
        public MeshGeometry3D PreviewMold(double resolution)
        {
            var mold = new BolusMold(_displayMesh, resolution);

            return(mold.Mesh);
        }
Ejemplo n.º 4
0
        public MeshGeometry3D PreviewMoldWhileRotating(double resolution, Vector3D axis, double angle)
        {
            var mold = new BolusMold(_displayMesh, resolution, axis, angle);

            return(mold.Mesh);
        }