Example #1
0
        public void InvertedForwardRhsRightTest()
        {
            Vector expected = rhsR;
            Vector actual   = OrthogonalAxis.RhsRight(-rhsU, -rhsF);

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void LhsForwardTest()
        {
            Vector expected = lhsF;
            Vector actual   = OrthogonalAxis.LhsForward(lhsR, lhsU);

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void LhsRightTest()
        {
            Vector expected = lhsR;
            Vector actual   = OrthogonalAxis.LhsRight(lhsU, lhsF);

            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void RhsRightTest()
        {
            Vector expected = rhsR;
            Vector actual   = OrthogonalAxis.RhsRight(rhsU, rhsF);

            Assert.AreEqual(expected, actual);
        }
Example #5
0
        public IEnumerable <Annotation> InferAnnotations(NewPrimitive toBeSnapped, SnappedPrimitive toBeAnnotated)
        {
            // we skip orthogonality inference for spheres
            if (toBeSnapped is NewSphere)
            {
                return(Enumerable.Empty <Annotation>());
            }

            var curvesToSkip = toBeAnnotated.FeatureCurves.Concat(GetSphereFeatureCurves()).ToArray();

            var candidates =
                from firstCurve in toBeAnnotated.FeatureCurves
                from secondCurve in sessionData.FeatureCurves.Except(curvesToSkip)
                where AreGoodCandidates(firstCurve, secondCurve)
                select Tuple.Create(firstCurve, secondCurve);

            if (candidates.Any())
            {
                var bestCandidate        = candidates.Minimizer(pair => DistanceBetweenCurves(pair.Item1, pair.Item2));
                var newFeatureCurve      = bestCandidate.Item1;
                var existingFeatureCurve = bestCandidate.Item2;

                Annotation curveOrthogonality = new OrthogonalAxis
                {
                    Elements = new FeatureCurve[] { newFeatureCurve, existingFeatureCurve }
                };

                return(UtilsEnumerable.ArrayOf(curveOrthogonality));
            }
            else
            {
                return(Enumerable.Empty <Annotation>());
            }
        }
Example #6
0
        private Term[] GetConcreteAnnotationTerm(OrthogonalAxis orthoonalAxes)
        {
            if (orthoonalAxes.Elements.Length != 2)
            {
                return(Enumerable.Empty <Term>().ToArray());
            }

            var firstNormal  = orthoonalAxes.Elements[0].Normal;
            var secondNormal = orthoonalAxes.Elements[1].Normal;
            var innerProduct = firstNormal * secondNormal;

            return(new Term[] { innerProduct });
        }