Beispiel #1
0
        public Line3D Intersect(PlaneHelper ps)
        {
            Line3D ret = new Line3D();

            var dir = Vector3d.Cross(ps.Normal, Normal);


            var k1 = ps.GetKoefs();
            var k2 = GetKoefs();
            var a1 = k1[0];
            var b1 = k1[1];
            var c1 = k1[2];
            var d1 = k1[3];

            var a2 = k2[0];
            var b2 = k2[1];
            var c2 = k2[2];
            var d2 = k2[3];



            var res1 = det2(new[] { a1, a2 }, new[] { b1, b2 }, new[] { -d1, -d2 });
            var res2 = det2(new[] { a1, a2 }, new[] { c1, c2 }, new[] { -d1, -d2 });
            var res3 = det2(new[] { b1, b2 }, new[] { c1, c2 }, new[] { -d1, -d2 });

            List <Vector3d> vvv = new List <Vector3d>();

            if (res1 != null)
            {
                Vector3d v1 = new Vector3d((float)res1[0], (float)res1[1], 0);
                vvv.Add(v1);
            }

            if (res2 != null)
            {
                Vector3d v1 = new Vector3d((float)res2[0], 0, (float)res2[1]);
                vvv.Add(v1);
            }
            if (res3 != null)
            {
                Vector3d v1 = new Vector3d(0, (float)res3[0], (float)res3[1]);
                vvv.Add(v1);
            }

            var pnt = vvv.OrderBy(z => z.Length).First();


            var r1 = plane.IsOnPlane(pnt);
            var r2 = plane.IsOnPlane(pnt);

            ret.Start = pnt;
            ret.End   = pnt + dir * 100;
            return(ret);
        }
Beispiel #2
0
        internal Vector3d[] GetPointsD()
        {
            PlaneSurface ps = new PlaneSurface()
            {
                Normal = Normal, Position = Location
            };

            if (!ps.IsOnPlane(AuxPoint))
            {
                return new Vector3d[] { }
            }
            ;
            var dir = AuxPoint - Location;

            norm = dir.Normalized();

            List <Vector3d> pnts = new List <Vector3d>();
            var             step = Math.PI * 5 / 180f;

            double sweepAngle = SweepAngle;

            if (FullEllipse)
            {
                sweepAngle = Math.PI * 2;
            }
            for (double i = 0; i < sweepAngle; i += step)
            {
                pnts.Add(point(i));
            }
            pnts.Add(point(sweepAngle));

            return(pnts.ToArray());
        }
    }