コード例 #1
0
        public Vector3d GeodesicTorsionAt(double t)
        {
            var c = Curve.DerivativeAt(t, 4);

            var theta   = Integrate.AdaptiveSimpson(u => TorsionAt(u), Curve.Domain.T0, t, 0.001);
            var theta_1 = TorsionAt(t);

            var a   = Vector3d.CrossProduct(c[1], c[2]);
            var a_1 = Vector3d.CrossProduct(c[1], c[3]) + Vector3d.CrossProduct(c[2], c[2]);

            var d   = a * c[3];
            var d_1 = a * c[4];

            var delta   = c[1].Length;
            var delta_1 = c[1] * c[2] / c[1].Length;

            var alpha   = a.Length;
            var alpha_1 = a * a_1 / a.Length;

            var T   = c[1] / delta;
            var T_1 = (delta * c[2] - c[1] * delta_1) / Math.Pow(delta, 2);

            var B   = a / alpha;
            var B_1 = (alpha * a_1 - a * alpha_1) / Math.Pow(alpha, 2);

            var N   = Vector3d.CrossProduct(B, T);
            var N_1 = Vector3d.CrossProduct(B, T_1) + Vector3d.CrossProduct(B_1, T);

            var e2 = N * Math.Cos(theta) + B * Math.Sin(theta);

            var e3   = B * Math.Cos(theta) - N * Math.Sin(theta);
            var e3_1 = Math.Cos(theta) * (B_1 - N * theta_1) - Math.Sin(theta) * (N_1 + B * theta_1);

            return(e3_1 * e2 * c[1] / c[1].SquareLength);
        }
コード例 #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // --- Input

            var curveOnSurface = default(IOrientableCurve);
            var a                 = default(double);
            var b                 = default(double);
            var tolerance         = default(double);
            var maximumIterations = default(int);

            if (!DA.GetData(0, ref curveOnSurface))
            {
                return;
            }
            if (!DA.GetData(1, ref a))
            {
                a = curveOnSurface.Domain.T0;
            }
            if (!DA.GetData(2, ref b))
            {
                b = curveOnSurface.Domain.T1;
            }
            if (!DA.GetData(3, ref tolerance))
            {
                return;
            }
            if (!DA.GetData(4, ref maximumIterations))
            {
                return;
            }

            // --- Execute

            var value  = Integrate.Romberg(Evaluate(curveOnSurface, false), a, b, tolerance, maximumIterations);
            var value2 = Integrate.Romberg(Evaluate(curveOnSurface, true), a, b, tolerance, maximumIterations);

            // --- Output

            DA.SetData(0, value);
            DA.SetData(1, value2);
        }
コード例 #3
0
        public Plane FrameAt(double t)
        {
            var t0 = Curve.Domain.T0;

            var theta = Integrate.AdaptiveSimpson(TorsionAt, t0, t, 0.001);

            var c = Curve.DerivativeAt(t, 3);

            var a     = Vector3d.CrossProduct(c[1], c[2]);
            var d     = a * c[3];
            var delta = c[1].Length;
            var alpha = a.Length;

            var P = c[0];
            var T = c[1] / delta;
            var B = a / alpha;
            var N = Vector3d.CrossProduct(B, T);

            var e2 = N * Math.Cos(theta) + B * Math.Sin(theta);
            var e3 = B * Math.Cos(theta) - N * Math.Sin(theta);

            return(new Plane(new Point3d(P), e2, e3));
        }