private Path <P, Vec3> CrossSection(Vec3 start, float bottom, int nodeCount) { start.Z -= 0.75f; var cPoints = new Vec3[] { start, new Vec3(start.X * 1.2f, bottom * 0.6f, start.Z), new Vec3(start.X * 0.9f, bottom * 1.2f, start.Z), }; var spline = BSpline <Vec3> .FromControlPoints(2, cPoints.Append (new Vec3(0f, bottom * 1.35f, start.Z)) .Concat (cPoints.Select(v => new Vec3(-v.X, v.Y, v.Z)).Reverse()) .ToArray()); return(Path <P, Vec3> .FromBSpline(spline, nodeCount - 1)); }
private Path <P, Vec3> CrossSection(Vec3 start, float top, int nodeCount) { start *= new Vec3(2f, 1f, 1f); var cPoints = new Vec3[] { start, new Vec3(start.X * 0.7f, top * 0.1f, start.Z), new Vec3(start.X * 0.6f, top * 0.7f, start.Z), }; var spline = BSpline <Vec3> .FromControlPoints(2, cPoints.Append (new Vec3(0f, top * 1.5f, start.Z)) .Concat (cPoints.Select(v => new Vec3(-v.X, v.Y, v.Z)).Reverse()) .ToArray()); return(Path <P, Vec3> .FromBSpline(spline, nodeCount)); }
public Nose(float middleHeight, float baseHeight, int numPoints, float bottomFlatness) { var spline = BSpline <Vec3> .FromControlPoints(2, new Vec3 (-1f, 0f, 0f), new Vec3 (0f, middleHeight, 0f), new Vec3 (1f, baseHeight, 0f)); Profile = Path <P, Vec3> .FromBSpline(spline, 8); Cone = Lathe <V> .Turn(Profile, turnAxis : Axis.X, offset : new Vec3(0f), stepAngle : MathHelper.TwoPi / numPoints) .ManipulateVertices( Manipulators.Scale <V> (1f, 1f - bottomFlatness, 1f).Where(v => v.position.Y < 0f), true) .RotateY(90f.Radians()) .Color(_color); XSection = Path <P, Vec3> .FromVecs( from v in Cone.Vertices.Furthest (Dir3D.Back) select v.position); }
public Canopy(float frontHeight, float backHeight, float bend, int numPoints) { var spline = BSpline <Vec3> .FromControlPoints(2, new Vec3 (-1.1f, 0f, 0f), new Vec3 (-1f, 0.2f, 0f), new Vec3 (-0f, frontHeight, 0f), new Vec3 (1f, backHeight, 0f), new Vec3 (2.5f, 0.1f, 0f), new Vec3 (2.5f, 0f, 0f) ); Profile = Path <P, Vec3> .FromBSpline(spline, numPoints); var angle = 105f.Radians(); Geometry = Lathe <V> .Turn(Profile, Axis.X, new Vec3 (0f), MathHelper.Pi / numPoints, -angle, angle) .RotateY(90f.Radians()) .RotateX(bend.Radians()) .Scale(0.85f, 1f, 1f) .Translate(0f, 0.6f, -2.3f) .Color(VertexColor <Vec3> .DarkGlass) .Reflectivity(0.4f); }