public static PolygonMesh.Mesh CreateCylinder(Cylinder.CylinderPrimitive cylinderToMeasure) { throw new NotImplementedException(); //PolygonMesh.Mesh cylinder = new PolygonMesh.Mesh(); //List<IVertex> bottomVerts = new List<IVertex>(); //List<IVertex> topVerts = new List<IVertex>(); //int sides = cylinderToMeasure.Sides; //for (int i = 0; i < sides; i++) //{ // Vector2 bottomRadialPos = Vector2.Rotate(new Vector2(cylinderToMeasure.Radius1, 0), MathHelper.Tau * i / sides); // IVertex bottomVertex = cylinder.CreateVertex(new Vector3(bottomRadialPos.X, bottomRadialPos.Y, -cylinderToMeasure.Height / 2)); // bottomVerts.Add(bottomVertex); // Vector2 topRadialPos = Vector2.Rotate(new Vector2(cylinderToMeasure.Radius1, 0), MathHelper.Tau * i / sides); // IVertex topVertex = cylinder.CreateVertex(new Vector3(topRadialPos.X, topRadialPos.Y, cylinderToMeasure.Height / 2)); // topVerts.Add(topVertex); //} //cylinder.ReverseFaceEdges(cylinder.CreateFace(bottomVerts.ToArray())); //cylinder.CreateFace(topVerts.ToArray()); //for (int i = 0; i < sides - 1; i++) //{ // cylinder.CreateFace(new IVertex[] { topVerts[i], bottomVerts[i], bottomVerts[i + 1], topVerts[i + 1] }); //} //cylinder.CreateFace(new IVertex[] { topVerts[sides - 1], bottomVerts[sides - 1], bottomVerts[0], topVerts[0] }); //return cylinder; }
public static PolygonMesh.Mesh CreateCylinder(Cylinder.CylinderPrimitive cylinderToMeasure) { PolygonMesh.Mesh cylinder = new PolygonMesh.Mesh(); List <Vertex> bottomVerts = new List <Vertex>(); List <Vertex> topVerts = new List <Vertex>(); int count = 20; for (int i = 0; i < count; i++) { Vector2 bottomRadialPos = Vector2.Rotate(new Vector2(cylinderToMeasure.Radius1, 0), MathHelper.Tau * i / 20); Vertex bottomVertex = cylinder.CreateVertex(new Vector3(bottomRadialPos.x, bottomRadialPos.y, -cylinderToMeasure.Height / 2)); bottomVerts.Add(bottomVertex); Vector2 topRadialPos = Vector2.Rotate(new Vector2(cylinderToMeasure.Radius1, 0), MathHelper.Tau * i / 20); Vertex topVertex = cylinder.CreateVertex(new Vector3(topRadialPos.x, topRadialPos.y, cylinderToMeasure.Height / 2)); topVerts.Add(topVertex); } cylinder.ReverseFaceEdges(cylinder.CreateFace(bottomVerts.ToArray())); cylinder.CreateFace(topVerts.ToArray()); for (int i = 0; i < count - 1; i++) { cylinder.CreateFace(new Vertex[] { topVerts[i], bottomVerts[i], bottomVerts[i + 1], topVerts[i + 1] }); } cylinder.CreateFace(new Vertex[] { topVerts[count - 1], bottomVerts[count - 1], bottomVerts[0], topVerts[0] }); return(cylinder); }
public string GetScadOutputRecursive(Cylinder.CylinderPrimitive objectToProcess, int level = 0) { string info = AddRenderInfoIfReqired(objectToProcess); info += "cylinder(r1=" + objectToProcess.Radius1.ToString() + ", r2=" + objectToProcess.Radius2.ToString() + ", h=" + objectToProcess.Height.ToString() + ", center=true, $fn={0});".FormatWith(NumberOfCylinderSegments) + AddNameAsComment(objectToProcess); return(ApplyIndent(info, level)); }
public CsgObject DoCopyAndFlatten(Cylinder.CylinderPrimitive objectToProcess) { return(new Cylinder.CylinderPrimitive(objectToProcess)); }
public PolygonMesh.Mesh CsgToMeshRecursive(Cylinder.CylinderPrimitive objectToProcess) { return(CreateCylinder(objectToProcess)); }
public IRayTraceable GetIRayTraceableRecursive(Cylinder.CylinderPrimitive objectToProcess) { return(new CylinderShape(objectToProcess.Radius1, objectToProcess.Height, DefaultMaterial)); }
public void RenderToGlRecursive(Cylinder.CylinderPrimitive objectToProcess) { RGBA_Floats partColor = new RGBA_Floats(.8, .8, 1); RenderMeshToGl.Render(CreateCylinder(objectToProcess), partColor); }
public void RenderToGlRecursive(Cylinder.CylinderPrimitive objectToProcess) { var partColor = new ColorF(.8, .8, 1).ToColor(); GLHelper.Render(CreateCylinder(objectToProcess), partColor); }
public PolygonMesh.Mesh CsgToMeshRecursive(Cylinder.CylinderPrimitive objectToProcess) { throw new NotImplementedException(); }