public static BoxUV Union(this BoxUV a, BoxUV b) { return(BoxUV.Create( a.RangeU.Union(b.RangeU), a.RangeV.Union(b.RangeV) )); }
public static double Bilinear(BoxUV bounds, double[,] values, PointUV t) { double divisor = (double) 1 / bounds.RangeU.Span / bounds.RangeV.Span; double dx1 = t.U - bounds.RangeU.Start; double dx2 = bounds.RangeU.End - t.U; double dy1 = t.V - bounds.RangeV.Start; double dy2 = bounds.RangeV.End - t.V; return ( values[0, 0] * dx2 * dy2 + values[1, 0] * dx1 * dy2 + values[0, 1] * dx2 * dy1 + values[1, 1] * dx1 * dy1 ) * divisor; }
public static double Bilinear(BoxUV bounds, double[,] values, PointUV t) { double divisor = (double)1 / bounds.RangeU.Span / bounds.RangeV.Span; double dx1 = t.U - bounds.RangeU.Start; double dx2 = bounds.RangeU.End - t.U; double dy1 = t.V - bounds.RangeV.Start; double dy2 = bounds.RangeV.End - t.V; return(( values[0, 0] * dx2 * dy2 + values[1, 0] * dx1 * dy2 + values[0, 1] * dx2 * dy1 + values[1, 1] * dx1 * dy1 ) * divisor); }
public static Point Bilinear(BoxUV bounds, Point[,] values, PointUV t) { var xs = new double[2, 2]; var ys = new double[2, 2]; var zs = new double[2, 2]; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { xs[i, j] = values[i, j].X; ys[i, j] = values[i, j].Y; zs[i, j] = values[i, j].Z; } } return Point.Create( Bilinear(bounds, xs, t), Bilinear(bounds, ys, t), Bilinear(bounds, zs, t) ); }
public static Point Bilinear(BoxUV bounds, Point[,] values, PointUV t) { var xs = new double[2, 2]; var ys = new double[2, 2]; var zs = new double[2, 2]; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { xs[i, j] = values[i, j].X; ys[i, j] = values[i, j].Y; zs[i, j] = values[i, j].Z; } } return(Point.Create( Bilinear(bounds, xs, t), Bilinear(bounds, ys, t), Bilinear(bounds, zs, t) )); }
// Creates all Spheres on the points found in method getSpherePoints public void createSpheres(List <SpherePoint> points, double multiplier) { int count = 1; foreach (SpherePoint point in points) { Direction dir = Direction.Create(1, 1, 0); Frame frame = Frame.Create(Point.Create(point.X, point.Y, point.Z), dir); //result += point.radius + ", "; Sphere sphere = Sphere.Create(frame, (point.radius * multiplier)); BoxUV box = new BoxUV(); Body body1 = Body.CreateSurfaceBody(sphere, box); DesignBody designBody = DesignBody.Create(Window.ActiveWindow.Document.MainPart, "Sphere" + count, body1); count++; } }