public static IBody2 CreateCirclularSheet(this IModeler modeler, Vector3 center, Vector3 vNormal, float radius) { var surf = (Surface)modeler.CreatePlanarSurface(center.ToDoubles(), vNormal.ToDoubles()); var startPoint = center + vNormal.Orthogonal().Unit() * radius; var endPoint = startPoint; var arc = (Curve) modeler.CreateArc (center.ToDoubles(), vNormal.ToDoubles(), (float)radius, startPoint.ToDoubles(), endPoint.ToDoubles()); return((IBody2)surf.CreateTrimmedSheet(new[] { arc })); }
/// <summary> /// Create a bounded sheet. /// </summary> /// <param name="modeler"></param> /// <param name="center">Center of the surface</param> /// <param name="vNormal">Direction of the surface</param> /// <param name="p0">Point to project onto surface to find UV bounds</param> /// <param name="p1">Point to project onto surface to find UV bounds</param> /// <returns></returns> public static IBody2 CreateSheet(this IModeler modeler, Vector3 center, Vector3 vNormal, double r) { var surf = (Surface)modeler.CreatePlanarSurface(center.ToDoubles(), vNormal.ToDoubles()); var mid = surf.GetClosestPointOnTs(center); var midPoint = mid.Point.ToVector3(); var upVector = (surf.PointAt(mid.U, mid.V + 1) - midPoint).Unit(); var rightVector = (surf.PointAt(mid.U + 1, mid.V) - midPoint).Unit(); var low = midPoint - upVector * r - rightVector * r; var high = midPoint + upVector * r + rightVector * r; var uvLow = surf.GetClosestPointOnTs(low); var uvHigh = surf.GetClosestPointOnTs(high); return(modeler.CreateSheetFromSurface(surf, uvLow, uvHigh)); }