Пример #1
0
 public static void TransformPosArray(this M44d mat, V3d[] points)
 {
     for (int i = 0; i < points.Length; i++)
     {
         points[i] = mat.TransformPos(points[i]);
     }
 }
Пример #2
0
        public static V3d[] TransformedPosArray(this M44d mat, ICollection <V3d> points)
        {
            var result = new V3d[points.Count];
            int i      = 0;

            foreach (var p in points)
            {
                result[i++] = mat.TransformPos(p);
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// Copies from the position array indexed by a backward map into
        /// a target array, starting at the supplied offset, thereby
        /// transforming all positions using the supplied matrix.
        /// </summary>
        /// <returns>target array</returns>
        public static V3f[] BackwardIndexedTransformPosAndCopyTo(
            this V3f[] source,
            V3f[] target,
            int[] backwardMap,
            int offset,
            M44d m44d)
        {
            var count = backwardMap.Length;

            for (int i = 0; i < count; i++)
            {
                target[i + offset] = (V3f)m44d.TransformPos((V3d)source[backwardMap[i]]);
            }
            return(target);
        }
Пример #4
0
 public static V3d[] TransformedPos(this V3d[] points, M44d matrix)
 {
     return(points.Map(p => matrix.TransformPos(p)));
 }
Пример #5
0
 /// <summary>
 /// Returns the ray transformed with the given matrix.
 /// </summary>
 public Ray3d Transformed(M44d mat)
 {
     return(new Ray3d(mat.TransformPos(Origin),
                      mat.TransformDir(Direction)));
 }
Пример #6
0
 /// <summary>
 /// Transforms a 2d polygon into 3d.
 /// The z-coordinate is assumed to be zero.
 /// </summary>
 public static Polygon3d Transformed(this Polygon2d polygon, M44d transform)
 {
     return(new Polygon3d(polygon.GetPointArray(p => transform.TransformPos(p.XYO))));
 }