Пример #1
0
        /// <summary>
        ///     Creates a square flat surface on the XY Plane.
        /// </summary>
        /// <param name="xDimension">Dimension interval on the X direction.</param>
        /// <param name="yDimension">Dimension interval on the Y direction.</param>
        /// <param name="xCount">Number of points on the X direction.</param>
        /// <param name="yCount">Number of points on the Y direction.</param>
        /// <returns>Flat nurbs surface.</returns>
        public static NurbsSurface CreateFlatSurface(
            Interval xDimension,
            Interval yDimension,
            int xCount,
            int yCount)
        {
            var m = new Matrix <Point4d>(xCount, yCount);

            for (var i = 0; i < xCount; i++)
            {
                for (var j = 0; j < yCount; j++)
                {
                    m[i, j] = new Point4d(
                        xDimension.RemapFromUnit(( double )i / xCount),
                        yDimension.RemapFromUnit(( double )j / yCount),
                        0,
                        1);
                }
            }

            var degreeU = xCount <= 3 ? xCount - 1 : 3;
            var degreeV = yCount <= 3 ? yCount - 1 : 3;

            return(new NurbsSurface(m, degreeU, degreeV));
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Point3d"/> class from a 4-dimensional point by dividing the cartesian coordinates by the weight.
 /// </summary>
 /// <param name="point">4d point to convert.</param>
 /// <returns><see cref="Point3d"/>.</returns>
 public Point3d(Point4d point)
     : this(point.X / point.Weight, point.Y / point.Weight, point.Z / point.Weight)
 {
 }