Example #1
0
        private CRSTransform(CRSTransform toCopy)
        {
            Name            = toCopy.Name;
            sourceTransform = toCopy.sourceTransform;

            right   = toCopy.right;
            up      = toCopy.up;
            forward = toCopy.forward;

            global = new Transform(toCopy.global);
        }
Example #2
0
        private CRSTransform(CRSTransform source, string name)
        {
            Name            = name;
            sourceTransform = source;

            if (null != source)
            {
                right   = source.right;
                up      = source.up;
                forward = source.forward;

                global = new Transform(source.Transform);
            }
        }
Example #3
0
        /// <summary>
        /// Sets the mapping vector to transform.
        /// </summary>
        /// <param name="targetCRS">The target vector (this transform)</param>
        /// <param name="sourceCRS">The source vector (refererring transform)</param>
        private void SetReferenceVector(GlobalReferenceAxis targetCRS, GlobalReferenceAxis?sourceCRS)
        {
            switch (Math.Abs((int)targetCRS))
            {
            case 1:
                global.R.Rx = GetUnitAxis(sourceCRS ?? GlobalReferenceAxis.PositiveX).Scale(Math.Sign((int)targetCRS));
                break;

            case 2:
                global.R.Ry = GetUnitAxis(sourceCRS ?? GlobalReferenceAxis.PositiveY).Scale(Math.Sign((int)targetCRS));
                break;

            case 3:
                global.R.Rz = GetUnitAxis(sourceCRS ?? GlobalReferenceAxis.PositiveZ).Scale(Math.Sign((int)targetCRS));
                break;
            }
        }
Example #4
0
        public static XYZ GetUnitAxis(GlobalReferenceAxis referenceAxis)
        {
            int axis = (int)referenceAxis;

            switch (Math.Abs(axis))
            {
            case 1:
                return(new XYZ(Math.Sign(axis), 0, 0));

            case 2:
                return(new XYZ(0, Math.Sign(axis), 0));

            case 3:
                return(new XYZ(0, 0, Math.Sign(axis)));
            }
            throw new NotSupportedException();
        }