public static SurfaceDomains _GetMinMaxUV(this Surface srf) { var domainU = srf.Domain(0); var domainV = srf.Domain(1); var bound = new SurfaceDomains(domainU.Min, domainU.Max, domainV.Min, domainV.Max); return(bound); }
public static SurfaceDomains _GetMinMaxUV(this Surface srf, Curve[] crvs2d, int divbyTrims) { var minU = srf.Domain(0).Max; // here we have to use max possible value to get properly works Math.Min() var maxU = srf.Domain(0).Min; // here we have to use min possible value to get properly works Math.Max() var minV = srf.Domain(1).Max; // here we have to use max possible value to get properly works Math.Min() var maxV = srf.Domain(1).Min; // here we have to use min possible value to get properly works Math.Max() divbyTrims = Math.Max(2, divbyTrims); // here we will store points for trim - for speed optimization Point3d[] devidedPoints; foreach (var crv in crvs2d) { if (divbyTrims == 2 || crv.Degree == 1) // for lines - we dont have to devide { devidedPoints = new[] { crv.PointAtStart, crv.PointAtEnd }; } else { crv._DivideByCount_ThreadSafe(divbyTrims - 1, true, out devidedPoints); } if (devidedPoints == null) { continue; } minU = Math.Min(minU, devidedPoints.Min(o => o.X)); maxU = Math.Max(maxU, devidedPoints.Max(o => o.X)); minV = Math.Min(minV, devidedPoints.Min(o => o.Y)); maxV = Math.Max(maxV, devidedPoints.Max(o => o.Y)); } var bound = new SurfaceDomains(minU, maxU, minV, maxV); return(bound); }