Example #1
0
            /// <summary>
            ///
            /// </summary>
            private static Orient3d GetHalfedgeTransform(E hedge, Func <V, Vector3d> getPosition, double unrollFactor)
            {
                if (unrollFactor < 0.0)
                {
                    return(Orient3d.Identity);
                }

                var he0 = hedge;
                var he1 = he0.Twin;

                Vector3d p0 = getPosition(he0.Start);
                Vector3d p1 = getPosition(he1.Start);

                Vector3d p2 = (getPosition(he0.Previous.Start) + getPosition(he0.Next.End)) * 0.5;
                Vector3d p3 = (getPosition(he1.Previous.Start) + getPosition(he1.Next.End)) * 0.5;

                Vector3d x  = p1 - p0;
                Vector3d y0 = p2 - p0;
                Vector3d y1 = (unrollFactor < 1.0) ? y0.SlerpTo(p1 - p3, unrollFactor) : p1 - p3; // TODO handle anti-parallel case

                var t0 = new Orient3d(OrthoBasis3d.CreateFromXY(x, y0), p0);
                var t1 = new Orient3d(OrthoBasis3d.CreateFromXY(x, y1), p0);

                return(Orient3d.CreateFromTo(ref t0, ref t1));
            }
Example #2
0
            /// <summary>
            ///
            /// </summary>
            private static Orient3d GetHalfedgeTransform(E hedge, Func <V, Vector3d> getPosition)
            {
                var he0 = hedge;
                var he1 = he0.Twin;

                Vector3d p0 = getPosition(he0.Start);
                Vector3d p1 = getPosition(he1.Start);

                Vector3d p2 = (getPosition(he0.Previous.Start) + getPosition(he0.Next.End)) * 0.5;
                Vector3d p3 = (getPosition(he1.Previous.Start) + getPosition(he1.Next.End)) * 0.5;

                Vector3d x  = p1 - p0;
                var      t0 = new Orient3d(OrthoBasis3d.CreateFromXY(x, p2 - p0), p0);
                var      t1 = new Orient3d(OrthoBasis3d.CreateFromXY(x, p1 - p3), p0);

                return(Orient3d.CreateFromTo(ref t0, ref t1));
            }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="plane"></param>
 /// <returns></returns>
 public static Orient3d ToOrient3d(this Plane plane)
 {
     return(new Orient3d(OrthoBasis3d.CreateFromXY(plane.XAxis, plane.YAxis), plane.Origin));
 }