// get clone public HE_Mesh get() { HE_Mesh result = new HE_Mesh(); reindex(); for (int i = 0; i < vertices.Count; i++) { result.vertices.Add((vertices [i]).getClone()); } for (int i = 0; i < faces.Count; i++) { result.faces.Add(new HE_Face()); } for (int i = 0; i < halfEdges.Count; i++) { result.halfEdges.Add(new HE_HalfEdge()); } for (int i = 0; i < edges.Count; i++) { result.edges.Add(new HE_Edge()); } // for (int i = 0; i < vertices.Count; i++) { HE_Vertex sv = vertices [i]; HE_Vertex tv = result.vertices [i]; tv.halfEdge = result.halfEdges [sv.halfEdge.id]; } for (int i = 0; i < faces.Count; i++) { HE_Face sf = faces [i]; HE_Face tf = result.faces [i]; tf.id = i; tf.halfEdge = result.halfEdges [sf.halfEdge.id]; } for (int i = 0; i < edges.Count; i++) { HE_Edge se = edges [i]; HE_Edge te = result.edges [i]; te.halfEdge = result.halfEdges [se.halfEdge.id]; te.id = i; } for (int i = 0; i < halfEdges.Count; i++) { HE_HalfEdge she = halfEdges [i]; HE_HalfEdge the = result.halfEdges [i]; the.pair = result.halfEdges [she.pair.id]; the.next = result.halfEdges [she.next.id]; the.prev = result.halfEdges [she.prev.id]; the.vert = result.vertices [she.vert.id]; the.face = result.faces [she.face.id]; the.edge = result.edges [she.edge.id]; the.id = i; } return(result); }
/// <summary> /// Computes the barycentric dual area around a given mesh vertex. /// </summary> /// <returns>The dual area.</returns> /// <param name="vertex">Vertex.</param> public static double BarycentricDualArea(HE_Vertex vertex) { double area = 0.0; foreach (HE_Face f in vertex.adjacentFaces()) { area += Area(f); } return(area); }
/// <summary> /// Compute the Mean curvature at the given vertex /// </summary> /// <param name="vertex">Vertex to compute Mean curvature</param> /// <returns>Number representing the Mean curvature at that vertex.</returns> public static double scalarMeanCurvature(HE_Vertex vertex) { double sum = 0.0; foreach (HE_HalfEdge hE in vertex.adjacentHalfEdges()) { sum += 0.5 * Length(hE.Edge) * DihedralAngle(hE); } return(sum); }
/// <summary> /// Computes the gauss curvature weighted normal arround the specified vertex /// </summary> /// <returns>The normal vector at that vertex.</returns> /// <param name="vertex">Vertex.</param> public static Vector3d VertexNormalGaussCurvature(HE_Vertex vertex) { Vector3d n = new Vector3d(); foreach (HE_HalfEdge hE in vertex.adjacentHalfEdges()) { double weight = 0.5 * DihedralAngle(hE) / Length(hE.Edge); n -= (Vector(hE) * weight); } return(n.Unit()); }
/// <summary> /// Computes the mean curvature weighted normal arround the specified vertex /// </summary> /// <returns>The normal vector at that vertex.</returns> /// <param name="vertex">Vertex.</param> public static Vector3d VertexNormalMeanCurvature(HE_Vertex vertex) { Vector3d n = new Vector3d(); foreach (HE_HalfEdge hE in vertex.adjacentHalfEdges()) { double weight = 0.5 * Cotan(hE) + Cotan(hE.Twin); n -= (Vector(hE) * weight); } return(n.Unit()); }
/// <summary> /// Computes the equally weighted normal arround the specified vertex /// </summary> /// <returns>The normal vector at that vertex.</returns> /// <param name="vertex">Vertex.</param> public static Vector3d VertexNormalEquallyWeighted(HE_Vertex vertex) { Vector3d n = new Vector3d(); foreach (HE_Face f in vertex.adjacentFaces()) { n += FaceNormal(f); } return(n.Unit()); }
/// <summary> /// Computes the angle defect at the given vertex /// </summary> /// <param name="vertex">Vertex to compute angle defect.</param> /// <returns>Number representing the deviation of the current vertex from $2\PI$</returns> public static double AngleDefect(HE_Vertex vertex) { double angleSum = 0.0; foreach (HE_Corner c in vertex.adjacentCorners()) { angleSum += Angle(c); } //if (vertex.OnBoundary()) angleSum = Math.PI - angleSum; return(vertex.OnBoundary() ? Math.PI - angleSum : 2 * Math.PI - angleSum); }
/// <summary> /// Computes the angle weighted normal arround the specified vertex /// </summary> /// <returns>The normal vector at that vertex.</returns> /// <param name="vertex">Vertex.</param> public static Vector3d VertexNormalAngleWeighted(HE_Vertex vertex) { Vector3d n = new Vector3d(); foreach (HE_Corner c in vertex.adjacentCorners()) { Vector3d normal = FaceNormal(c.HalfEdge.Face); double angle = Angle(c); n += (normal * angle); } return(n.Unit()); }
/// <summary> /// Computes the sphere inscribed normal arround the specified vertex /// </summary> /// <returns>The normal vector at that vertex.</returns> /// <param name="vertex">Vertex.</param> public static Vector3d VertexNormalSphereInscribed(HE_Vertex vertex) { Vector3d n = new Vector3d(); foreach (HE_Corner c in vertex.adjacentCorners()) { Vector3d u = Vector(c.HalfEdge.Prev); Vector3d v = -Vector(c.HalfEdge.Next); n += ((u.Cross(v) / (u.Length2 * v.Length2))); } return(n.Unit()); }
/// <summary> /// Computes the area weighted normal arround the specified vertex /// </summary> /// <returns>The normal vector at that vertex.</returns> /// <param name="vertex">Vertex.</param> public static Vector3d VertexNormalAreaWeighted(HE_Vertex vertex) { Vector3d n = new Vector3d(); foreach (HE_Face f in vertex.adjacentFaces()) { Vector3d normal = FaceNormal(f); double area = Area(f); n += (normal * area); } return(n.Unit()); }
/// <summary> /// Computes the circumcentric dual area around a given mesh vertex. /// </summary> /// <returns>The dualarea.</returns> /// <param name="vertex">Vertex.</param> public static double CircumcentricDualarea(HE_Vertex vertex) { double area = 0.0; foreach (HE_HalfEdge hE in vertex.adjacentHalfEdges()) { double u2 = Vector(hE.Prev).Length2; double v2 = Vector(hE).Length2; double cotAlpha = Cotan(hE.Prev); double cotBeta = Cotan(hE); area += (u2 * cotAlpha + v2 * cotBeta) / 8; } return(area); }
public void drawMesh() { List <Triangle3D> triangles3D = new List <Triangle3D> (); List <Vector3> vertices = new List <Vector3> (); List <int> triangles = new List <int> (); List <Vector2> uvs = new List <Vector2> (); for (int i = 0; i < voronoiCells.Length; i++) { Triangle3D tri = voronoiCells [i].draw(); triangles3D.Add(tri); } int indexCount = 0; for (int i = 0; i < triangles3D.Count; i++) { Triangle3D tri = triangles3D [i]; for (int n = 0; n < tri.vertices.Count; n++) { HE_Vertex hV = tri.vertices [n]; vertices.Add(hV.pos); triangles.Add(indexCount); uvs.Add(Vector2.zero); indexCount++; } } if (mesh == null) { mesh = new Mesh(); mesh.name = "generateMesh"; } mesh.Clear(); mesh.vertices = vertices.ToArray(); mesh.triangles = triangles.ToArray(); mesh.uv = uvs.ToArray(); //mesh.SetIndices(triangles.ToArray(), MeshTopology.Triangles, 0); mesh.RecalculateNormals(); meshFilter.mesh = mesh; //Material tempmaterial = new Material(lineshader); //renderer.material = tempmaterial; }
//FLAWED public void roundEdges(float d) { if (d <= 0) { return; } List <Plane> cutPlanes = new List <Plane> (); PVector center = new PVector(); for (int i = 0; i < vertices.Count; i++) { HE_Vertex v = vertices [i]; center.add(v); } center.div(vertices.Count); for (int i = 0; i < edges.Count; i++) { HE_Edge e = edges [i]; HE_Vertex v1 = e.halfEdge.vert; HE_Vertex v2 = e.halfEdge.pair.vert; HE_Vertex v = new HE_Vertex(0.5f * (v1.x + v2.x), 0.5f * (v1.y + v2.y), 0.5f * (v1.z + v2.z), 0); PVector n = PVector.sub(v, center); //float distanceToVertex=n.mag(); //if(distanceToVertex>d){ float distanceToVertex = n.magSq(); if (distanceToVertex > d * d) { float ratio = (distanceToVertex - d) / distanceToVertex; PVector origin = PVector.mult(n, ratio); origin.add(center); cutPlanes.Add(new Plane(origin, n)); } } for (int i = 0; i < cutPlanes.Count; i++) { Plane P = cutPlanes [i]; cutMesh(P, center); } }
public override void mousePressed() { PVector O = new PVector(random(-S, S), random(-S, S), random(-S, S)); Plane P = new Plane(O, new PVector(random(-1, 1), random(-1, 1), random(-1, 1))); List <HE_Mesh> newMeshes = new List <HE_Mesh> (); List <PVector> newCenters = new List <PVector> (); for (int i = 0; i < meshes.Count; i++) { HE_Mesh mesh = (HE_Mesh)meshes [i]; HE_Mesh mesh2 = mesh.get(); mesh.cutMesh(P, new PVector()); mesh2.cutMesh(P, new PVector(2 * O.x, 2 * O.y, 2 * O.z)); newMeshes.Add(mesh); newMeshes.Add(mesh2); PVector center = new PVector(); for (int j = 0; j < mesh.vertices.Count; j++) { HE_Vertex v = (HE_Vertex)mesh.vertices [j]; center.add(v); } center.div(mesh.vertices.Count); newCenters.Add(center); center = new PVector(); for (int j = 0; j < mesh2.vertices.Count; j++) { HE_Vertex v = (HE_Vertex)mesh2.vertices [j]; center.add(v); } center.div(mesh2.vertices.Count); newCenters.Add(center); } meshes = newMeshes; centers = newCenters; // drawMesh(); }
// A hack-n-slash approach to voronoi, literally. The individual cells are created by iteratively splitting // the container mesh by the bisector planes of all other points. (Bisector plane = plane perpendicular to line // between two points, positioned halfway between the points) void buildVoronoi() { for (int i = 0; i < numPoints; i++) { // each Voronoi cell starts as the entire container voronoiCells [i] = container.get(); } for (int i = 0; i < numPoints; i++) { for (int j = 0; j < numPoints; j++) { if (i != j) { PVector N = PVector.sub(points [j], points [i]); // plane normal=normalized vector pinting from point i to point j N.normalize(); PVector O = PVector.add(points [j], points [i]); // plane origin=point halfway between point i and point j O.mult(0.5f); O.x += N.x * offset_size; O.y += N.y * offset_size; O.z += N.z * offset_size; P = new Plane(O, N); voronoiCells [i].cutMesh(P, points [i]); } } } for (int i = 0; i < numPoints; i++) { centers [i] = new PVector(); for (int j = 0; j < voronoiCells[i].vertices.Count; j++) { HE_Vertex v = (HE_Vertex)voronoiCells [i].vertices [j]; centers [i].add(v); } centers [i].div(voronoiCells [i].vertices.Count); } }
/// <summary> /// Compute the principal curvature scalar values at a given vertes. /// </summary> /// <param name="vertex">Vertex to compute the curvature.</param> /// <returns>Returns an array of 2 values {k1, k2}.</returns> public static double[] PrincipalCurvatures(HE_Vertex vertex) { double A = CircumcentricDualarea(vertex); double H = scalarMeanCurvature(vertex) / A; double K = AngleDefect(vertex) / A; double discriminant = H * H - K; if (discriminant > 0) { discriminant = Math.Sqrt(discriminant); } else { discriminant = 0; } double k1 = H - discriminant; double k2 = H + discriminant; return(new double[] { k1, k2 }); }
public void roundCorners(float d) { if (d <= 0) { return; } List <Plane> cutPlanes = new List <Plane> (); PVector center = new PVector(); for (int i = 0; i < vertices.Count; i++) { HE_Vertex v = vertices [i]; center.add(v); } center.div(vertices.Count); for (int i = 0; i < vertices.Count; i++) { HE_Vertex v = vertices [i]; PVector n = PVector.sub(v, center); //float distanceToVertex=n.mag(); //if(distanceToVertex>d){ float distanceToVertex = n.magSq(); if (distanceToVertex > d * d) { float ratio = (distanceToVertex - d) / distanceToVertex; PVector origin = PVector.mult(n, ratio); origin.add(center); cutPlanes.Add(new Plane(origin, n)); } } for (int i = 0; i < cutPlanes.Count; i++) { Plane P = cutPlanes [i]; cutMesh(P, center); } }
void drawMesh() { List <Triangle3D> triangles3D = new List <Triangle3D> (); for (int i = 0; i < meshes.Count; i++) { PVector center = (PVector)centers [i]; HE_Mesh mesh = (HE_Mesh)meshes [i]; /* * //mesh.drawEdges(); * foreach (HE_Edge e in mesh.edges) { * Vector3 p0 = e.halfEdge.vert.pos; * Vector3 p1 = e.halfEdge.pair.vert.pos; * Debug.DrawLine (p0 + center.pos * 0.2f, p1 + center.pos * 0.2f, Color.red); * } */ Triangle3D tri = mesh.draw(); triangles3D.Add(tri); } List <Vector3> vertices = new List <Vector3> (); List <int> triangles = new List <int> (); List <Vector2> uvs = new List <Vector2> (); int indexCount = 0; for (int i = 0; i < triangles3D.Count; i++) { Triangle3D tri = triangles3D [i]; PVector center = (PVector)centers [i]; for (int n = 0; n < tri.vertices.Count; n++) { HE_Vertex hV = tri.vertices [n]; vertices.Add(hV.pos + center.pos * 0.2f); triangles.Add(indexCount); uvs.Add(Vector2.zero); indexCount++; } } if (generateMesh == null) { generateMesh = new Mesh(); generateMesh.name = "generateMesh"; } generateMesh.Clear(false); generateMesh.vertices = vertices.ToArray(); generateMesh.triangles = triangles.ToArray(); generateMesh.uv = uvs.ToArray(); //generateMesh.SetIndices(triangles.ToArray(), MeshTopology.Triangles, 0); generateMesh.RecalculateNormals(); meshFilter.mesh = generateMesh; //Material tempmaterial = new Material(lineshader); //renderer.material = tempmaterial; }
// Split the mesh in half, retain the part on the same side as the point "center". // Works only on a convex mesh !!! public void cutMesh(Plane P, PVector center) { float centerside = P.side(center); if (centerside != 0) // if center is on the plane, we can't decide which part to keep, ignore. { List <HE_Vertex> newVertices = new List <HE_Vertex> (); List <HE_Face> newFaces = new List <HE_Face> (); List <HE_HalfEdge> newHalfEdges = new List <HE_HalfEdge> (); List <HE_Edge> newEdges = new List <HE_Edge> (); // get all split edges List <SplitEdge> splitEdges = retrieveSplitEdges(P); //check if the plane cuts the mesh at all, at least one point should be on the other side of the plane. //compared to the first point float[] sides = new float[vertices.Count]; //bool cut = false;// add inok for (int i = 0; i < vertices.Count; i++) { HE_Vertex v = vertices [i]; sides [i] = P.side(v); //if(sides[0]*sides[i]<=0f) cut=true;// add inok } //loop through all faces. for (int i = 0; i < faces.Count; i++) { HE_Face face = faces [i]; HE_HalfEdge halfEdge = face.halfEdge; List <HE_Vertex> newFaceVertices1 = new List <HE_Vertex> (); // vertices on the correct side. List <HE_Vertex> newFaceVertices2 = new List <HE_Vertex> (); // vertices on the wrong side, not used right now. //for each face, loop through all vertices and retain the vertices on the correct side. If the edge //is cut, insert the new point in the appropriate place. do { if (sides [halfEdge.vert.id] * centerside >= 0f) { newFaceVertices1.Add(halfEdge.vert); } if (sides [halfEdge.vert.id] * centerside <= 0f) { newFaceVertices2.Add(halfEdge.vert); } for (int j = 0; j < splitEdges.Count; j++) // loop through all split edges to check for the current edge. { SplitEdge se = splitEdges [j]; if (halfEdge.edge == se.edge) { newFaceVertices1.Add(se.splitVertex); newFaceVertices2.Add(se.splitVertex); break; } } halfEdge = halfEdge.next; } while(halfEdge != face.halfEdge); //Create a new face form the vertices we retained,ignore degenerate faces with less than 3 vertices. //Add all face-related information to the data-structure. if (newFaceVertices1.Count > 2) { HE_Face newFace = new HE_Face(); newFaces.Add(newFace); List <HE_HalfEdge> faceEdges = new List <HE_HalfEdge> (); for (int j = 0; j < newFaceVertices1.Count; j++) { HE_Vertex v = newFaceVertices1 [j]; if (!newVertices.Contains(v)) { newVertices.Add(v); } HE_HalfEdge newHalfEdge = new HE_HalfEdge(); faceEdges.Add(newHalfEdge); newHalfEdge.vert = v; v.halfEdge = newHalfEdge; newHalfEdge.face = newFace; if (newFace.halfEdge == null) { newFace.halfEdge = newHalfEdge; } } cycleHalfEdges(faceEdges, false); newHalfEdges.AddRange(faceEdges); } } //Add missing information to the datastructure int n = newHalfEdges.Count; pairHalfEdges(newHalfEdges); createEdges(newHalfEdges, newEdges); //Cutting the mesh not only cuts the faces, it also creates one new planar face looping through all new cutpoints(in a convex mesh). //This hole in the mesh is identified by unpaired halfedges remaining after the pairibg operation. //This part needs to rethought to extend to concave meshes!!! List <HE_HalfEdge> unpairedEdges = new List <HE_HalfEdge> (); for (int i = 0; i < n; i++) { HE_HalfEdge he = newHalfEdges [i]; if (he.pair == null) { unpairedEdges.Add(he); } } if (unpairedEdges.Count > 0) { //Create a closed loop out of the collection of unpaired halfedges and associate a new face with this. //Easy to explain with a drawing, beyond my skill with words. HE_Face cutFace = new HE_Face(); List <HE_HalfEdge> faceEdges = new List <HE_HalfEdge> (); HE_HalfEdge he = unpairedEdges [0]; HE_HalfEdge hen = he; do { HE_HalfEdge _hen = he.next; HE_HalfEdge _hep = he.next.pair; if (_hep != null) //add inok { hen = he.next.pair.next; while (!unpairedEdges.Contains(hen)) { hen = hen.pair.next; } } else { hen = hen.next; Debug.LogWarning("LogWarning: null"); } HE_HalfEdge newhe = new HE_HalfEdge(); faceEdges.Add(newhe); if (cutFace.halfEdge == null) { cutFace.halfEdge = newhe; } newhe.vert = hen.vert; newhe.pair = he; he.pair = newhe; HE_Edge e = new HE_Edge(); e.halfEdge = newhe; he.edge = e; newhe.edge = e; newEdges.Add(e); newhe.face = cutFace; he = hen; } while(hen != unpairedEdges[0]); cycleHalfEdges(faceEdges, true); newHalfEdges.AddRange(faceEdges); newFaces.Add(cutFace); } // update the mesh vertices = newVertices; faces = newFaces; halfEdges = newHalfEdges; edges = newEdges; reindex(); } }
/// <summary> /// Compute the Gaussian curvature at the given vertex /// </summary> /// <param name="vertex">Vertex to compute Gaussian curvature</param> /// <returns>Number representing the gaussian curvature at that vertex.</returns> public static double scalarGaussCurvature(HE_Vertex vertex) { return(AngleDefect(vertex) / HE_MeshGeometry.CircumcentricDualarea(vertex)); }
void splitSurface(Plane P) { List <HE_Vertex> newVertices = new List <HE_Vertex> (); List <HE_Face> newFaces = new List <HE_Face> (); List <HE_HalfEdge> newHalfEdges = new List <HE_HalfEdge> (); List <HE_Edge> newEdges = new List <HE_Edge> (); // get all split edges List <SplitEdge> splitEdges = retrieveSplitEdges(P); //check if the plane cuts the mesh at all, at least one point should be on the other side of the plane. //compared to the first point float[] sides = new float[vertices.Count]; //bool cut=false; for (int i = 0; i < vertices.Count; i++) { HE_Vertex v = vertices [i]; sides [i] = P.side(v); //if(sides[0]*sides[i]<=0f) cut=true; } //loop through all faces. for (int i = 0; i < faces.Count; i++) { HE_Face face = faces [i]; HE_HalfEdge halfEdge = face.halfEdge; List <HE_Vertex> newFaceVertices1 = new List <HE_Vertex> (); List <HE_Vertex> newFaceVertices2 = new List <HE_Vertex> (); List <HE_Vertex> currentFace = newFaceVertices1; //for each face, loop through all vertices and retain the vertices on the correct side. If the edge //is cut, insert the new point in the appropriate place. do { currentFace.Add(halfEdge.vert); for (int j = 0; j < splitEdges.Count; j++) // loop through all split edges to check for the current edge. { SplitEdge se = (SplitEdge)splitEdges [j]; if (halfEdge.edge == se.edge) { newFaceVertices1.Add(se.splitVertex); newFaceVertices2.Add(se.splitVertex); if (currentFace == newFaceVertices1) { currentFace = newFaceVertices2; } else { currentFace = newFaceVertices1; } break; } } halfEdge = halfEdge.next; } while(halfEdge != face.halfEdge); //Create a new face form the vertices we retained,ignore degenerate faces with less than 3 vertices. //Add all face-related information to the data-structure. HE_Face newFace = new HE_Face(); newFaces.Add(newFace); List <HE_HalfEdge> faceEdges = new List <HE_HalfEdge> (); for (int j = 0; j < newFaceVertices1.Count; j++) { HE_Vertex v = newFaceVertices1 [j]; if (!newVertices.Contains(v)) { newVertices.Add(v); } HE_HalfEdge newHalfEdge = new HE_HalfEdge(); faceEdges.Add(newHalfEdge); newHalfEdge.vert = v; v.halfEdge = newHalfEdge; newHalfEdge.face = newFace; if (newFace.halfEdge == null) { newFace.halfEdge = newHalfEdge; } } cycleHalfEdges(faceEdges, false); newHalfEdges.AddRange(faceEdges); if (newFaceVertices2.Count > 0) { newFace = new HE_Face(); newFaces.Add(newFace); faceEdges = new List <HE_HalfEdge> (); for (int j = 0; j < newFaceVertices2.Count; j++) { HE_Vertex v = newFaceVertices2 [j]; if (!newVertices.Contains(v)) { newVertices.Add(v); } HE_HalfEdge newHalfEdge = new HE_HalfEdge(); faceEdges.Add(newHalfEdge); newHalfEdge.vert = v; v.halfEdge = newHalfEdge; newHalfEdge.face = newFace; if (newFace.halfEdge == null) { newFace.halfEdge = newHalfEdge; } } cycleHalfEdges(faceEdges, false); newHalfEdges.AddRange(faceEdges); //}//test } //Add missing information to the datastructure pairHalfEdges(newHalfEdges); createEdges(newHalfEdges, newEdges); } // update the mesh vertices = newVertices; faces = newFaces; halfEdges = newHalfEdges; edges = newEdges; reindex(); }
// draw as a triangular mesh. public Triangle3D draw() { Triangle3D triangle3d = new Triangle3D(); for (int i = 0; i < faces.Count; i++) { HE_Face face = faces [i]; HE_HalfEdge halfEdge = face.halfEdge; HE_Vertex midFace = new HE_Vertex(0, 0, 0, 0); int c = 0; do { HE_Vertex v = halfEdge.vert; midFace.x += v.x; midFace.y += v.y; midFace.z += v.z; halfEdge = halfEdge.next; c++; } while(halfEdge != face.halfEdge); midFace.x /= c; midFace.y /= c; midFace.z /= c; halfEdge = face.halfEdge; HE_Vertex vv; do { HE_Vertex v0 = halfEdge.vert; HE_Vertex v1 = halfEdge.next.vert; triangle3d.vertices.Add(midFace); triangle3d.vertices.Add(v1); triangle3d.vertices.Add(v0); halfEdge = halfEdge.next; } while(halfEdge != face.halfEdge); //beginShape(TRIANGLE_STRIP); /* * GL.Begin(GL.TRIANGLE_STRIP); * HE_Vertex vv; * do{ * vv=halfEdge.vert; * GL.Vertex3(vv.x,vv.y,vv.z); * GL.Vertex3(midFace.x,midFace.y,midFace.z); * halfEdge= halfEdge.next; * } * while(halfEdge!=face.halfEdge); * vv=halfEdge.vert; * GL.Vertex3(vv.x,vv.y,vv.z); * //endShape(); * GL.End(); */ /* * HE_Vertex vv; * do{ * vv=halfEdge.vert; * //GL.Vertex3(vv.x,vv.y,vv.z); * //GL.Vertex3(midFace.x,midFace.y,midFace.z); * triangle3d.vertices.Add(vv); * triangle3d.vertices.Add(midFace); * * halfEdge= halfEdge.next; * } * while(halfEdge!=face.halfEdge); * vv=halfEdge.vert; * * //GL.Vertex3(vv.x,vv.y,vv.z); * triangle3d.vertices.Add(vv); */ } return(triangle3d); }
public SplitEdge(HE_Edge e, PVector p) { edge = e; splitVertex = new HE_Vertex(p.x, p.y, p.z, 0); }