internal DSObject RestoreProperDSType(DSObject d) { Geometry g = Geometry.cast(d); if (g != null) { return(RestoreProperType(g)); } Vector v = Vector.cast(d); if (v != null) { return(v); } CoordinateSystem cs = CoordinateSystem.cast(d); if (cs != null) { return(cs); } return(d); }
public override Value Evaluate(FSharpList <Value> args) { Vector p = (Vector)((Value.Container)args[0]).Item; double z = p.z(); return(Value.NewNumber(z)); }
public override Value Evaluate(FSharpList <Value> args) { Point origin = (Point)((Value.Container)args[0]).Item; Vector normal = (Vector)((Value.Container)args[1]).Item; _plane = Plane.by_origin_normal(origin, normal); return(Value.NewContainer(_plane)); }
public override Value Evaluate(FSharpList <Value> args) { Curve curve = (Curve)((Value.Container)args[0]).Item; double param = ((Value.Number)args[1]).Item; _vector = curve.normal_at_parameter(param); return(Value.NewContainer(_vector)); }
public override Value Evaluate(FSharpList <Value> args) { Surface surf = (Surface)((Value.Container)args[0]).Item; double u = ((Value.Number)args[1]).Item; double v = ((Value.Number)args[2]).Item; _vector = surf.normal_at_parameter(u, v); return(Value.NewContainer(_vector)); }
public override Value Evaluate(FSharpList <Value> args) { Point cp = (Point)((Value.Container)args[0]).Item; double r = ((Value.Number)args[1]).Item; Vector normal = (Vector)((Value.Container)args[2]).Item; _circle = Circle.by_center_point_radius_normal(cp, r, normal); return(Value.NewContainer(_circle)); }
public override Value Evaluate(FSharpList <Value> args) { Point origin = (Point)((Value.Container)args[0]).Item; Vector x_axis = (Vector)((Value.Container)args[1]).Item; Vector y_axis = (Vector)((Value.Container)args[2]).Item; _cs = CoordinateSystem.by_origin_vectors(origin, x_axis, y_axis); return(Value.NewContainer(_cs)); }
public override Value Evaluate(FSharpList <Value> args) { Curve curve = (Curve)((Value.Container)args[0]).Item; Vector dir = (Vector)((Value.Container)args[1]).Item; double dist = ((Value.Number)args[2]).Item; _surface = curve.extrude(dir, dist); GraphicItem.persist(_surface); return(Value.NewContainer(_surface)); }
public override Value Evaluate(FSharpList <Value> args) { double x, y, z; x = ((Value.Number)args[0]).Item; y = ((Value.Number)args[1]).Item; z = ((Value.Number)args[2]).Item; if (_vector == null) { _vector = Vector.by_coordinates(x, y, z); } else { _vector.set_x(x); _vector.set_y(y); _vector.set_z(z); } return(Value.NewContainer(_vector)); }
public override Value Evaluate(FSharpList <Value> args) { DSObject item = (DSObject)((Value.Container)args[0]).Item; Vector v = (Vector)((Value.Container)args[1]).Item; DSObject cloned = item.clone(); _transformableItem = RestoreProperDSType(cloned) as TransformableItem; // TODO: throw exception if not transformable item _transformableItem.translate(v.x(), v.y(), v.z()); GraphicItem graphicItem = _transformableItem as GraphicItem; if (graphicItem != null) { GraphicItem.persist(graphicItem); } return(Value.NewContainer(_transformableItem)); }
public override Value Evaluate(FSharpList<Value> args) { Surface surf = (Surface)((Value.Container)args[0]).Item; double u = ((Value.Number)args[1]).Item; double v = ((Value.Number)args[2]).Item; _vector = surf.normal_at_parameter(u, v); return Value.NewContainer(_vector); }
public override Value Evaluate(FSharpList<Value> args) { Curve curve = (Curve)((Value.Container)args[0]).Item; double param = ((Value.Number)args[1]).Item; _vector = curve.normal_at_parameter(param); return Value.NewContainer(_vector); }
public override Value Evaluate(FSharpList<Value> args) { double x, y, z; x = ((Value.Number)args[0]).Item; y = ((Value.Number)args[1]).Item; z = ((Value.Number)args[2]).Item; if (_vector == null) { _vector = Vector.by_coordinates(x, y, z); } else { _vector.set_x(x); _vector.set_y(y); _vector.set_z(z); } return Value.NewContainer(_vector); }