Exemple #1
0
        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);
        }
Exemple #2
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Vector p = (Vector)((Value.Container)args[0]).Item;

            double z = p.z();

            return(Value.NewNumber(z));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        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));
        }
Exemple #6
0
        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));
        }
Exemple #7
0
        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));
        }
Exemple #8
0
        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));
        }
Exemple #9
0
        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));
        }
Exemple #10
0
        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));
        }
Exemple #11
0
        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);
        }
Exemple #12
0
        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);
        }
Exemple #13
0
        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);
        }