public IRayTraceable GetIRayTraceableRecursive(Sphere objectToProcess) { throw new NotImplementedException(); #if false string info = ""; if (objectToProcess.Name.Length > 0 && (objectToProcess.Name[0] == '#' || objectToProcess.Name[0] == '%')) { info = objectToProcess.Name[0] + " "; } info += "sphere(" + objectToProcess.Radius.ToString() + ");" + AddNameAsComment(objectToProcess); return ApplyIndent(info, level); #endif }
public void RoundPoint(Face threeFacesThatSharePoint, double radius, double extraDimension = defaultExtraDimension) { if (roundedPoints.ContainsKey(threeFacesThatSharePoint)) { return; } double radiusBoxSize = radius + extraDimension; switch (threeFacesThatSharePoint) { case Face.Left | Face.Front | Face.Bottom: { RoundEdge(Edge.LeftFront, radius, extraDimension); RoundEdge(Edge.LeftBottom, radius, extraDimension); RoundEdge(Edge.FrontBottom, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, extraDimension, extraDimension, extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), -extraDimension, -extraDimension, -extraDimension); root += pointRound; } break; case Face.Left | Face.Front | Face.Top: { RoundEdge(Edge.LeftFront, radius, extraDimension); RoundEdge(Edge.LeftTop, radius, extraDimension); RoundEdge(Edge.FrontTop, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, extraDimension, extraDimension, -extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), -extraDimension, -extraDimension, extraDimension); root += pointRound; } break; case Face.Left | Face.Back | Face.Bottom: { RoundEdge(Edge.LeftBack, radius, extraDimension); RoundEdge(Edge.LeftBottom, radius, extraDimension); RoundEdge(Edge.BackBottom, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, extraDimension, -extraDimension, extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), -extraDimension, extraDimension, -extraDimension); root += pointRound; } break; case Face.Left | Face.Back | Face.Top: { RoundEdge(Edge.LeftBack, radius, extraDimension); RoundEdge(Edge.LeftTop, radius, extraDimension); RoundEdge(Edge.BackTop, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, extraDimension, -extraDimension, -extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), -extraDimension, extraDimension, extraDimension); root += pointRound; } break; case Face.Right | Face.Front | Face.Bottom: { RoundEdge(Edge.RightFront, radius, extraDimension); RoundEdge(Edge.RightBottom, radius, extraDimension); RoundEdge(Edge.FrontBottom, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, -extraDimension, extraDimension, extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), extraDimension, -extraDimension, -extraDimension); root += pointRound; } break; case Face.Right | Face.Front | Face.Top: { RoundEdge(Edge.RightFront, radius, extraDimension); RoundEdge(Edge.RightTop, radius, extraDimension); RoundEdge(Edge.FrontTop, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, -extraDimension, extraDimension, -extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), extraDimension, -extraDimension, extraDimension); root += pointRound; } break; case Face.Right | Face.Back | Face.Bottom: { RoundEdge(Edge.RightBack, radius, extraDimension); RoundEdge(Edge.RightBottom, radius, extraDimension); RoundEdge(Edge.BackBottom, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, -extraDimension, -extraDimension, extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), extraDimension, extraDimension, -extraDimension); root += pointRound; } break; case Face.Right | Face.Back | Face.Top: { RoundEdge(Edge.RightBack, radius, extraDimension); RoundEdge(Edge.RightTop, radius, extraDimension); RoundEdge(Edge.BackTop, radius, extraDimension); CsgObject pointRound = new Box(radiusBoxSize, radiusBoxSize, radiusBoxSize, "box"); CsgObject pointCut = new Sphere(radius, "sphere"); pointCut = new Align(pointCut, threeFacesThatSharePoint, pointRound, threeFacesThatSharePoint, -extraDimension, -extraDimension, -extraDimension); pointRound -= pointCut; pointRound = new Align(pointRound, threeFacesThatSharePoint, GetEdgeOffset(threeFacesThatSharePoint), extraDimension, extraDimension, extraDimension); root += pointRound; } break; default: throw new NotImplementedException("Don't know how to round " + threeFacesThatSharePoint.ToString()); } if (!roundedPoints.ContainsKey(threeFacesThatSharePoint)) { roundedPoints.Add(threeFacesThatSharePoint, radius); } }
public Sphere(Sphere objectToCopy) : this(objectToCopy.radius, objectToCopy.name) { }
public CsgObject DoCopyAndFlatten(Sphere objectToProcess) { return new Sphere(objectToProcess); }
public string GetScadOutputRecursive(Sphere objectToProcess, int level = 0) { string info = AddRenderInfoIfReqired(objectToProcess); info += "sphere(" + objectToProcess.Radius.ToString() + ", $fn={0});".FormatWith(NumberOfCylinderSegments) + AddNameAsComment(objectToProcess); return ApplyIndent(info, level); }
public PolygonMesh.Mesh CsgToMeshRecursive(Sphere objectToProcess) { throw new NotImplementedException(); #if false info += "sphere(" + objectToProcess.Radius.ToString() + ", $fn=40);" ; return ApplyIndent(info); #endif }
public string GetScadOutputRecursive(Sphere objectToProcess, int level = 0) { string info = AddRenderInfoIfReqired(objectToProcess); info += "sphere(" + objectToProcess.Radius.ToString() + ", $fn=40);" + AddNameAsComment(objectToProcess); return ApplyIndent(info, level); }