Пример #1
0
        public static CurveToCurveRelation CenteredVertical_CenteredHorizontal()
        {
            var geoA = new LineCurve(new Point3d(0, -1, 0), new Point3d(0, 1, 0)).ToNurbsCurve();
            var geoB = new LineCurve(new Point3d(-1, 0, 0), new Point3d(1, 0, 0)).ToNurbsCurve();

            return(Relate.This(geoA).To(geoB));
        }
Пример #2
0
        public static CurvesRelation PairedPinwheel()
        {
            var env = new List <Curve>
            {
                new LineCurve(Point3d.Origin, new Point3d(0, 1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(1, 1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(1, 0, 0)),
                new LineCurve(Point3d.Origin, new Point3d(1, -1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(0, -1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(-1, -1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(-1, 0, 0)),
                new LineCurve(Point3d.Origin, new Point3d(-1, 1, 0))
            };

            var envB = new List <Curve>
            {
                new LineCurve(Point3d.Origin, new Point3d(0, 1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(1, 1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(1, 0, 0)),
                new LineCurve(Point3d.Origin, new Point3d(1, -1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(0, -1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(-1, -1, 0)),
                new LineCurve(Point3d.Origin, new Point3d(-1, 0, 0)),
                new LineCurve(Point3d.Origin, new Point3d(-1, 1, 0))
            };

            env.AddRange(envB);

            return(Relate.This(env));
        }
Пример #3
0
        public void GroupsByColinearityIndexMap_should_throw_exception_when_read_if_unresolved()
        {
            var rel = Relate.This(new List <Curve>());

            Action act = () => { var x = rel.Properties.GroupsByColinearityIndexMap; };

            act.Should().Throw <UnresolvedPropertyException>("because the property was read before it was actually resolved");
        }
        public void Given_disjoint_curves_should_return_false()
        {
            Relate.This(new LineCurve(new Point3d(1, 0, 0), new Point3d(1, 1, 0))).To(new LineCurve(new Point3d(0, 0, 0), new Point3d(0, 1, 0)))
            .Resolve()
            .IfIntersectionExists()
            .Results(out var resA, out var resB);

            resA.IntersectionExists.Should().BeFalse("because the curves do not intersect");
        }
Пример #5
0
        public static CurvesRelation ParallelOffsetCurves()
        {
            var env = new List <Curve>
            {
                new LineCurve(new Point3d(0, 0, 0), new Point3d(0, 1, 0)),
                new LineCurve(new Point3d(2, 0, 0), new Point3d(2, 1, 0))
            };

            return(Relate.This(env));
        }
Пример #6
0
        public static CurvesRelation CrossingCurves()
        {
            var env = new List <Curve>
            {
                new LineCurve(new Point3d(-2, 0, 0), new Point3d(0, 2, 0)),
                new LineCurve(new Point3d(0, -2, 0), new Point3d(0, 2, 0))
            };

            return(Relate.This(env));
        }
Пример #7
0
        public static CurvesRelation HorizontalDashedLine()
        {
            var env = new List <Curve>
            {
                new LineCurve(new Point3d(0, 0, 0), new Point3d(1, 0, 0)),
                new LineCurve(new Point3d(2, 0, 0), new Point3d(3, 0, 0)),
                new LineCurve(new Point3d(4, 0, 0), new Point3d(5, 0, 0))
            };

            return(Relate.This(env));
        }
Пример #8
0
        public static CurvesRelation ShuffledPairedPinwheel()
        {
            var env = PairedPinwheel().Geometry;
            var rng = new Random();

            int n = env.Count;

            while (n > 1)
            {
                n--;
                int k   = rng.Next(n + 1);
                var val = env[k];
                env[k] = env[n];
                env[n] = val;
            }

            return(Relate.This(env));
        }
Пример #9
0
        public void Should_be_instantiated_when_curve_collection_is_related()
        {
            var rel = Relate.This(new List <Curve>());

            rel.Should().BeOfType <Ibis.Relations.CurvesRelation>("because it is relating a collection of curves");
        }
        public void Should_be_instantiated_when_curve_is_related_to_curve()
        {
            var rel = Relate.This(new LineCurve()).To(new LineCurve());

            rel.Should().BeOfType <Ibis.Relations.CurveToCurveRelation>("because it is relating a curve to a curve");
        }