예제 #1
0
            /// <summary>
            ///
            /// </summary>
            private static Orient3d GetHalfedgeTransform(E hedge, Func <V, Vec3d> getPosition, Func <E, double> getUnrollFactor = null)
            {
                if (getUnrollFactor == null)
                {
                    return(GetHalfedgeTransform(hedge, getPosition));
                }

                var t = getUnrollFactor(hedge);

                if (t < 0.0)
                {
                    return(Orient3d.Identity);
                }

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

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

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

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

                return(Orient3d.CreateFromTo(
                           new Orient3d(p0, x, y0),
                           new Orient3d(p0, x, y1)
                           ));
            }
예제 #2
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));
            }
예제 #3
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));
            }
예제 #4
0
            /// <summary>
            ///
            /// </summary>
            private static Orient3d GetHalfedgeTransform(E hedge, Func <V, Vec3d> getPosition)
            {
                var he0 = hedge;
                var he1 = he0.Twin;

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

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

                Vec3d x = p1 - p0;

                return(Orient3d.CreateFromTo(
                           new Orient3d(p0, x, p2 - p0),
                           new Orient3d(p0, x, p1 - p3)
                           ));
            }