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; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// // =========================================== 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); }