Example #1
0
        public StraightGlulam(Curve curve) : base()
        {
            Centreline = curve;
            //Centreline.Domain.MakeIncreasing();

            Plane p;

            Centreline.PerpendicularFrameAt(Centreline.Domain.Min, out p);
            Orientation = new VectorOrientation(Vector3d.ZAxis);
        }
Example #2
0
        public StraightGlulam(Curve curve, Plane[] planes, bool with_twist = false) : base()
        {
            Centreline = curve;
            //Centreline.Domain.MakeIncreasing();

            if (planes == null || planes.Length < 1)
            {
                Plane plane;
                Centreline.PerpendicularFrameAt(Centreline.Domain.Min, out plane);
                planes = new Plane[] { plane };
            }

            if (!Centreline.IsLinear(Tolerance))
            {
                throw new Exception("StraightGlulam only works with a linear centreline!");
            }

            List <Vector3d> vectors    = new List <Vector3d>();
            List <double>   parameters = new List <double>();

            if (with_twist)
            {
                double t;
                foreach (var plane in planes)
                {
                    Centreline.ClosestPoint(plane.Origin, out t);

                    parameters.Add(t);
                    vectors.Add(plane.YAxis);
                }
                Orientation = new VectorListOrientation(Centreline, parameters, vectors);
            }
            else
            {
                var origin = Centreline.PointAtStart;
                var x_axis = Vector3d.CrossProduct(planes[0].YAxis, Centreline.TangentAtStart);
                var y_axis = Vector3d.CrossProduct(Centreline.TangentAtStart, x_axis);

                Orientation = new VectorOrientation(y_axis);
            }
        }