Class ControlPointNet

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.util.List<ControlPoint>>, javolution.lang.Immutable, javolution.lang.ValueType, javolution.xml.XMLSerializable

    public class ControlPointNet
    extends java.lang.Object
    implements java.lang.Iterable<java.util.List<ControlPoint>>, java.lang.Cloneable, javolution.xml.XMLSerializable, javolution.lang.ValueType
    A network or matrix of control points for a NURBS surface in n-dimensional space.

    Modified by: Joseph A. Huwaldt

    Version:
    February 17, 2025
    Author:
    Joseph A. Huwaldt, Date: June 15, 2010
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Returns a copy of this ControlPointNet instance allocated by the calling thread (possibly on the stack).
      ControlPointNet copy()
      Returns a copy of this ControlPointNet instance allocated by the calling thread (possibly on the stack).
      boolean equals​(java.lang.Object obj)
      Compares this ControlPointNet against the specified object for strict equality (same sized lists of the equal ControlPoints).
      ControlPoint get​(int s, int t)
      Returns the ControlPoint at the specified s,t position in this matrix.
      Point getBoundsMax()
      Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z) of this matrix of ControlPoint objects.
      Point getBoundsMin()
      Return the coordinate point representing the minimum bounding box corner (e.g.: min X, min Y, min Z) of this matrix of ControlPoint objects.
      java.util.List<ControlPoint> getColumn​(int tIndex)
      Returns a list of ControlPoint objects that represent a single column in this network of control points.
      int getNumberOfColumns()
      Return the control point matrix size in the t-direction (across the columns of control points).
      int getNumberOfRows()
      Return the control point matrix size in the s-direction (down a column of control points).
      java.util.List<ControlPoint> getRow​(int sIndex)
      Returns a list of ControlPoint objects that represent a single row in this network of control points.
      javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
      Returns the unit in which the control points in this network are stated.
      int hashCode()
      Returns the hash code for this parameter.
      boolean isValid()
      Return true if this ControlPointNet contains valid and finite numerical components.
      java.util.Iterator<java.util.List<ControlPoint>> iterator()
      Returns an iterator over the lists of ControlPoint objects in this network.
      ControlPointNet reverseColumns()
      Return a new control point network that is identical to this one but with the columns in reverse order.
      ControlPointNet reverseRows()
      Return a new control point network that is identical to this one but with the rows in reverse order.
      int size()
      Returns the total number of control points in this matrix of control points.
      ControlPointNet to​(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
      Returns the equivalent to this control point network but stated in the specified unit.
      ControlPointNet toDimension​(int newDim)
      Return the equivalent of this control point network converted to the specified number of physical dimensions.
      java.lang.String toString()
      Returns the String representation of this control point matrix that consists of the control points listed out.
      javolution.text.Text toText()
      Returns the text representation of this control point matrix that consists of the the control points listed out.
      ControlPointNet transpose()
      Return a new control point network that is the transpose of this network (the rows & columns are swapped).
      static ControlPointNet valueOf​(ControlPoint[][] cps)
      Returns a ControlPointNet instance made up of the control points in the specified java matrix.
      static ControlPointNet valueOf​(ControlPointNet cpNet)
      Returns a ControlPointNet instance made up of the control points contained in the specified network.
      static ControlPointNet valueOf​(java.util.List<? extends java.util.List<ControlPoint>> cps)
      Returns a ControlPointNet instance made up of the control points in the specified list of lists.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • valueOf

        public static ControlPointNet valueOf​(ControlPoint[][] cps)
        Returns a ControlPointNet instance made up of the control points in the specified java matrix.
        Parameters:
        cps - Matrix of control points: cps[t][s]. s-parameter runs down a column of points and the t-parameter runs across the columns of points. May not be null.
        Returns:
        A ControlPointNet object using the data in the specified matrix.
      • valueOf

        public static ControlPointNet valueOf​(java.util.List<? extends java.util.List<ControlPoint>> cps)
        Returns a ControlPointNet instance made up of the control points in the specified list of lists.
        Parameters:
        cps - List of lists (matrix) of control points: cps.get(t).get(s). s-parameter runs down a column of points and the t-parameter runs across the columns of points. May not be null.
        Returns:
        A ControlPointNet object using the data in the specified matrix.
      • valueOf

        public static ControlPointNet valueOf​(ControlPointNet cpNet)
        Returns a ControlPointNet instance made up of the control points contained in the specified network.
        Parameters:
        cpNet - An existing control point net. The control points from this network are used to make this one. May not be null.
        Returns:
        A ControlPointNet object using the data in the specified network.
      • size

        public int size()
        Returns the total number of control points in this matrix of control points.
        Returns:
        The total number of control points in this network.
      • getNumberOfRows

        public int getNumberOfRows()
        Return the control point matrix size in the s-direction (down a column of control points).
        Returns:
        The number of rows in this control point network.
      • getNumberOfColumns

        public int getNumberOfColumns()
        Return the control point matrix size in the t-direction (across the columns of control points).
        Returns:
        The number of columns in this control point network.
      • get

        public ControlPoint get​(int s,
                                int t)
        Returns the ControlPoint at the specified s,t position in this matrix.
        Parameters:
        s - the index in the s-direction (down a column of points).
        t - the index in the t-direction (across the columns of points).
        Returns:
        the control point at the s,t position in this matrix.
        Throws:
        java.lang.IndexOutOfBoundsException - (s < 0) || (s ≥ getNumberOfRows()) || t < 0 || (t ≥ getNumberOfColumns()) )
      • getRow

        public java.util.List<ControlPointgetRow​(int sIndex)
        Returns a list of ControlPoint objects that represent a single row in this network of control points.
        Parameters:
        sIndex - The index for the row of control points to return.
        Returns:
        The specified row of control points.
        Throws:
        java.lang.IndexOutOfBoundsException - sIndex < 0 || (sIndex ≥ getNumberOfRows()) )
      • getColumn

        public java.util.List<ControlPointgetColumn​(int tIndex)
        Returns a list of ControlPoint objects that represent a single column in this network of control points.
        Parameters:
        tIndex - The index for the column of control points to return.
        Returns:
        The specified column of control points.
        Throws:
        java.lang.IndexOutOfBoundsException - tIndex < 0 || (tIndex ≥ getNumberOfColumns()) )
      • getBoundsMin

        public Point getBoundsMin()
        Return the coordinate point representing the minimum bounding box corner (e.g.: min X, min Y, min Z) of this matrix of ControlPoint objects.
        Returns:
        The minimum bounding box coordinate for this geometry element.
      • getBoundsMax

        public Point getBoundsMax()
        Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z) of this matrix of ControlPoint objects.
        Returns:
        The maximum bounding box coordinate for this geometry element.
      • transpose

        public ControlPointNet transpose()
        Return a new control point network that is the transpose of this network (the rows & columns are swapped).
        Returns:
        A new ControlPointNet identical to this one but with the rows and columns transposed.
      • reverseRows

        public ControlPointNet reverseRows()
        Return a new control point network that is identical to this one but with the rows in reverse order.
        Returns:
        A new ControlPointNet identical to this one but with the row order reversed.
      • reverseColumns

        public ControlPointNet reverseColumns()
        Return a new control point network that is identical to this one but with the columns in reverse order.
        Returns:
        A new ControlPointNet identical to this one but with the column order reversed.
      • getUnit

        public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
        Returns the unit in which the control points in this network are stated.
        Returns:
        The unit in which this control point network is stated.
      • to

        public ControlPointNet to​(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
                           throws javax.measure.converter.ConversionException
        Returns the equivalent to this control point network but stated in the specified unit.
        Parameters:
        unit - The length unit of the control point to be returned. May not be null.
        Returns:
        An equivalent to this control point network but stated in the specified unit.
        Throws:
        javax.measure.converter.ConversionException - if the the input unit is not a length unit.
      • toDimension

        public ControlPointNet toDimension​(int newDim)
        Return the equivalent of this control point network converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.
        Parameters:
        newDim - The dimension of the surface to return.
        Returns:
        The equivalent of this control point network converted to the new dimensions.
      • iterator

        public java.util.Iterator<java.util.List<ControlPoint>> iterator()
        Returns an iterator over the lists of ControlPoint objects in this network. The iterator returns lists containing the columns of control points.
        Specified by:
        iterator in interface java.lang.Iterable<java.util.List<ControlPoint>>
      • isValid

        public boolean isValid()
        Return true if this ControlPointNet contains valid and finite numerical components. A value of false will be returned if any of the control point values are NaN or Inf.
        Returns:
        true if this ControlPointNet contains valid and finite numerical components.
      • copy

        public ControlPointNet copy()
        Returns a copy of this ControlPointNet instance allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface javolution.lang.ValueType
        Returns:
        an identical and independent copy of this point.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Returns a copy of this ControlPointNet instance allocated by the calling thread (possibly on the stack).
        Returns:
        an identical and independent copy of this point.
        Throws:
        java.lang.CloneNotSupportedException - Never thrown.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this ControlPointNet against the specified object for strict equality (same sized lists of the equal ControlPoints).
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this point is identical to that point; false otherwise.
      • hashCode

        public int hashCode()
        Returns the hash code for this parameter.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code value.
      • toText

        public javolution.text.Text toText()
        Returns the text representation of this control point matrix that consists of the the control points listed out.
        Returns:
        the text representation of this geometry element.
      • toString

        public java.lang.String toString()
        Returns the String representation of this control point matrix that consists of the control points listed out.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the text representation of this geometry element.