Пример #1
0
        public Vector3 GetUnitMajorOrientation()
        {
            this.Update();

            // determine the longest side of the outer polygon
            return(MeshesCustom.GetUnitMajorOrientation(this.polygon));
        }
        static OcTreeManager()
        {
            LineBuilder b = new LineBuilder();

            b.AddBox(Vector3.Zero, 1, 1, 1);
            CellFrame = b.ToLineGeometry3D();

            EndPoint = LinesCutom.GetEndPointMarker(Vector3.Zero, (float)SNAPPOSMARKER_FACT * 0.8f);
            MidPoint = LinesCutom.GetMidPointMarker(Vector3.Zero, (float)SNAPPOSMARKER_FACT);
            IntPoint = LinesCutom.GetIntersectionMarker(Vector3.Zero, (float)SNAPPOSMARKER_FACT);

            ChamferedBoxMesh = MeshesCustom.GetChamferedBox(Vector3.Zero, 1f, 1f, 1f, 0.2f, 0.05f);
            MeshesCustom.CompressMesh(ref ChamferedBoxMesh);

            ChamferedBoxMesh_Normals = MeshesCustom.GetVertexNormalsAsLines(ChamferedBoxMesh, 0.15f);

            RedTransparent = new PhongMaterial();
            RedTransparent.DiffuseColor      = new Color4(0.8f, 0f, 0f, 0.25f);
            RedTransparent.AmbientColor      = new Color4(0.6f, 0f, 0f, 1f);
            RedTransparent.SpecularColor     = new Color4(1f, 0.75f, 0f, 1f);
            RedTransparent.SpecularShininess = 1;

            YellowTransparent = new PhongMaterial();
            YellowTransparent.DiffuseColor      = new Color4(1f, 0.93f, 0f, 0.5f);
            YellowTransparent.AmbientColor      = new Color4(0.92f, 0.69f, 0f, 1f);
            YellowTransparent.SpecularColor     = new Color4(1f, 1f, 1f, 1f);
            YellowTransparent.SpecularShininess = 3;
        }
Пример #3
0
        private void ContainedEnditiesToGeometryDef()
        {
            // reset
            this.outer_polygon_index = -1;
            this.polygon             = null;
            this.holes = null;

            // convert the contained entities into a list of coordinates
            float level_height = 0f;
            List <List <Point3D> > coordinates = new List <List <Point3D> >();

            foreach (Entity e in this.ContainedEntities)
            {
                ZonedPolygon zp = e as ZonedPolygon;
                if (zp != null && zp.Polygon_Coords.Count > 0)
                {
                    level_height = Math.Max(level_height, zp.Height);
                    coordinates.Add(zp.Polygon_Coords);
                }
            }

            this.Height = level_height;
            MeshesCustom.ToPolygonWithHoles(coordinates, Orientation.XZ,
                                            out this.outer_polygon_index, out this.polygon, out this.holes);
        }
Пример #4
0
        public void BuildLevelFill(bool _top)
        {
            this.Update();

            // calculate the fill geometry and the resulting area
            if (IsDirty)
            {
                this.Fill    = MeshesCustom.PolygonComplexFill(polygon, holes, _top);
                this.IsDirty = false;
            }
        }
Пример #5
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // =========================================== GEOMETRY DEFINITIONS ======================================= //
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region GEOMETRY DEFINITIONS

        private void UpdateGeometry()
        {
            // show the defining polygons
            LineBuilder b = new LineBuilder();
            int         n = coords_polygons.Count;

            if (n > 0)
            {
                for (int i = 0; i < n; i++)
                {
                    // transfer current polygon
                    List <Point3D> cp = coords_polygons[i];
                    int            m  = cp.Count;
                    if (m > 0)
                    {
                        // lines
                        for (int j = 0; j < m; j++)
                        {
                            b.AddLine(cp[j % m].ToVector3(), cp[(j + 1) % m].ToVector3());
                        }
                        // start maker
                        b.AddBox(cp[0].ToVector3(), START_MARKER, 0, START_MARKER);
                    }
                }
            }
            this.polygons.Geometry = b.ToLineGeometry3D();

            // show the resulting volume
            Vector3[] ar1 = CommonExtensions.ConvertPoint3DArToVector3Ar(this.coords_polygons[0].ToArray());
            Vector3[] ar2 = CommonExtensions.ConvertPoint3DArToVector3Ar(this.coords_polygons[1].ToArray());
            List <List <Vector3> > coords_poly_asV3 = CommonExtensions.ConvertPoints3DListListToVector3ListList(this.coords_polygons);
            bool capBottom = false;
            bool capTop    = true;

            HelixToolkit.SharpDX.Wpf.MeshGeometry3D volMesh =
                MeshesCustom.MeshFromNPolygons(coords_poly_asV3, this.reverse_polygons, capBottom, capTop);

            this.volume.Geometry        = volMesh;
            this.volumeNormals.Geometry = MeshesCustom.GetVertexNormalsAsLines(volMesh, 0.25f);
            this.volumeEdges.Geometry   = MeshesCustom.GetEdgesAsLines(volMesh);
        }
Пример #6
0
 public double GetAreaWoHoles()
 {
     return(MeshesCustom.CalculateAreaOfPolygonWHoles(this.polygon, this.holes));
 }
Пример #7
0
 public MeshGeometry3D GetDisplayMesh()
 {
     this.Update();
     return(MeshesCustom.PolygonComplexFill(this.polygon, this.holes, false));
 }
Пример #8
0
 private void CalculateArea()
 {
     this.Area = (float)MeshesCustom.CalculateAreaOfPolygonWHoles(this.polygon, this.holes);
 }