コード例 #1
0
 public void TranslateWith(Point3D translateValue)
 {
     _currTransform.SetValues(
         _currTransform.Value(1, 1), _currTransform.Value(1, 2), _currTransform.Value(1, 3),
         _currTransform.Value(1, 4) + translateValue.X,
         _currTransform.Value(2, 1), _currTransform.Value(2, 2), _currTransform.Value(2, 3),
         _currTransform.Value(2, 4) + translateValue.Y,
         _currTransform.Value(3, 1), _currTransform.Value(3, 2), _currTransform.Value(3, 3),
         _currTransform.Value(3, 4) + translateValue.Z,
         _angularPrecision, _distancePrecision
         );
     _pivot = _pivot.AddCoordinate(translateValue);
 }
コード例 #2
0
 private static void ApplyMatrixString(gpTrsf aTrans, IList <double> values)
 {
     aTrans.SetValues(
         values[0], values[1], values[2], values[3],
         values[4], values[5], values[6], values[7],
         values[8], values[9], values[10], values[11],
         Precision.Angular, Precision.Confusion);
 }
コード例 #3
0
        public static gpTrsf ConvertCoordinatesToGlobalTransformation(gpTrsf currentAxisSystem, double X, double Y,
                                                                      double Z)
        {
            var currentTransformation = new gpTrsf();

            currentTransformation.SetValues(1, 0, 0, X, 0, 1, 0, Y, 0, 0, 1, Z, _angularPrecision, _distancePrecision);
            return(ConvertToGlobalTransformation(currentAxisSystem, currentTransformation));
        }
コード例 #4
0
        public static gpTrsf ConvertToGlobalTransformation(gpTrsf currentAxisSystem,
                                                           gpTrsf currentTransformation)
        {
            var transformedCoordinates = new gpTrsf();

            transformedCoordinates = currentAxisSystem;
            transformedCoordinates.Multiply(currentTransformation);
            transformedCoordinates.SetValues(
                1, 0, 0, transformedCoordinates.Value(1, 4),
                0, 1, 0, transformedCoordinates.Value(2, 4),
                0, 0, 1, transformedCoordinates.Value(3, 4),
                _angularPrecision, _distancePrecision
                );
            return(transformedCoordinates);
        }
        public void TestTranslate()
        {
            var customAxisSystem = new gpTrsf();

            customAxisSystem.SetValues(1, 0, 0, 10, 0, 1, 0, 10, 0, 0, 1, 10, _angularPrecision, _distancePrecision);
            var aShapesTransformation = new gpTrsf();

            aShapesTransformation.SetValues(1, 0, 0, 10, 0, 1, 0, 10, 0, 0, 1, 10, _angularPrecision, _distancePrecision);
            var globalSystemtransformation = TransformationInterpreter.ConvertToGlobalTransformation(customAxisSystem,
                                                                                                     aShapesTransformation);

            Assert.IsTrue(Math.Abs(1 - globalSystemtransformation.Value(1, 1)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(0 - globalSystemtransformation.Value(1, 2)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(0 - globalSystemtransformation.Value(1, 3)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(20 - globalSystemtransformation.Value(1, 4)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(0 - globalSystemtransformation.Value(2, 1)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(1 - globalSystemtransformation.Value(2, 2)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(0 - globalSystemtransformation.Value(2, 3)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(20 - globalSystemtransformation.Value(2, 4)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(0 - globalSystemtransformation.Value(3, 1)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(0 - globalSystemtransformation.Value(3, 2)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(1 - globalSystemtransformation.Value(3, 3)) < 0.1, "incorrect transformation");
            Assert.IsTrue(Math.Abs(20 - globalSystemtransformation.Value(3, 4)) < 0.1, "incorrect transformation");
        }