Package geomss.geom

Class GeomPoint

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int W
      Constant used to identify the W or 4th coordinate.
      static int X
      Constant used to identify the X or 1st coordinate.
      static int Y
      Constant used to identify the Y or 2nd coordinate.
      static int Z
      Constant used to identify the Z or 3rd coordinate.
    • Constructor Summary

      Constructors 
      Constructor Description
      GeomPoint()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract GeomPoint copy()
      Returns a copy of this GeomPoint instance allocated by the calling thread (possibly on the stack).
      abstract Point copyToReal()
      Return a copy of this object with any transformations or subranges removed (applied).
      Parameter<javax.measure.quantity.Length> distance​(GeomPoint that)
      Return the Euclidian distance between this point and the one specified.
      Parameter<javax.measure.quantity.Area> distanceSq​(GeomPoint that)
      Return the square of the Euclidian distance between this point and the one specified.
      double distanceSqValue​(GeomPoint that)
      Return the Euclidian distance squared between this point and the one specified as a double.
      double distanceValue​(GeomPoint that)
      Return the Euclidian distance between this point and the one specified as a double.
      Point divide​(double divisor)
      Returns this point with each element divided by the specified divisor.
      Point divide​(Parameter<javax.measure.quantity.Dimensionless> divisor)
      Returns this point with each element divided by the specified dimensionless Parameter.
      Parameter<javax.measure.quantity.Length> get​(int i)
      Returns the value of a Parameter from this point.
      Point getBoundsMax()
      Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).
      Point getBoundsMin()
      Return the coordinate point representing the minimum bounding box corner (e.g.: min X, min Y, min Z).
      GeomPoint getLimitPoint​(int dim, boolean max, double tol)
      Returns the most extreme point, either minimum or maximum, in the specified coordinate direction on this geometry element.
      int getNumberOfPoints()
      Return the total number of points in this geometry element.
      int getParDimension()
      Returns the number of parametric dimensions of the geometry element.
      GeomPointTrans getTransformed​(GTransform transform)
      Returns transformed version of this element.
      abstract double getValue​(int i)
      Returns the value of a coordinate in this point as a double, stated in this point's unit.
      abstract double getValue​(int i, javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
      Returns the value of a coordinate in this point as a double, stated in the specified unit.
      double getX()
      Return the X-coordinate of this point as a double, stated in this point's unit.
      double getY()
      Return the Y-coordinate of this point as a double, stated in this point's unit.
      double getZ()
      Return the Z-coordinate of this point as a double, stated in this point's unit.
      abstract Point immutable()
      Return an immutable version of this point.
      boolean isApproxEqual​(GeomPoint obj)
      Compares this point against the specified point for approximate equality (coordinate values approximately equal to this one to within the numerical roundoff tolerance).
      boolean isApproxEqual​(GeomPoint obj, Parameter<javax.measure.quantity.Length> tol)
      Compares this point against the specified point for approximate equality (coordinate values approximately equal to this one to within the numerical roundoff tolerance).
      boolean isValid()
      Return true if this point contains valid and finite numerical components.
      Point max​(GeomPoint that)
      Returns a point consisting of the maximum value in each dimension between this point and the input point.
      Point min​(GeomPoint that)
      Returns a point consisting of the minimum value in each dimension between this point and the input point.
      abstract Point minus​(GeomPoint that)
      Returns the difference between this point and the one specified.
      abstract Point minus​(Parameter<javax.measure.quantity.Length> that)
      Subtracts the specified parameter from each component of this point.
      Parameter<javax.measure.quantity.Length> norm()
      Returns the Euclidian norm, magnitude, or length of the vector from the origin to this point (square root of the dot product of the origin-to-this-point vector and itself).
      Parameter<javax.measure.quantity.Area> normSq()
      Returns the square of the Euclidean norm, magnitude, or length of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself).
      abstract double normSqValue()
      Returns the square of the Euclidean norm, magnitude, or length value of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself).
      double normValue()
      Returns the norm(), magnitude, or length value of the vector from the origin to this point (square root of the dot product of the origin-to-this-point vector and itself).
      abstract Point opposite()
      Returns the negation of this point (all the values of each dimension negated).
      abstract Point plus​(GeomPoint that)
      Returns the sum of this point with the one specified.
      abstract Point plus​(Parameter<javax.measure.quantity.Length> that)
      Adds the specified parameter to each component of this point.
      int size()
      Returns the number of child-elements that make up this geometry element.
      abstract Point times​(double k)
      Returns the product of this point with the specified coefficient.
      Point times​(Parameter<javax.measure.quantity.Dimensionless> k)
      Returns the product of this point with the specified dimensionless Parameter.
      double[] toArray()
      Returns the values stored in this point as a Java array, stated in the current units.
      double[] toArray​(double[] array)
      Returns the values stored in this point, stated in the current units stored in the input Java array.
      abstract Float64Vector toFloat64Vector()
      Returns the values stored in this point, stated in the current units, as a Float64Vector.
      Vector<javax.measure.quantity.Length> toGeomVector()
      Returns a GeomVector representation of this point.
      ParameterVector<javax.measure.quantity.Length> toParameterVector()
      Returns a ParameterVector representation of this point.
      javolution.text.Text toText()
      Returns the text representation of this geometry element that consists of the name followed by the coordinate values.
      Vector3D<javax.measure.quantity.Length> toVector3D()
      Returns a Vector3D representation of this point if possible.
      • Methods inherited from class java.lang.Object

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

        compareTo
    • Method Detail

      • immutable

        public abstract Point immutable()
        Return an immutable version of this point.
        Returns:
        an immutable version of this point.
      • size

        public int size()
        Returns the number of child-elements that make up this geometry element. This implementation always returns 0 as a GeomPoint is not made up of any other elements.
        Specified by:
        size in interface GeomElement<GeomPoint>
        Returns:
        The number of child-elements that make up this geometry element.
      • getParDimension

        public int getParDimension()
        Returns the number of parametric dimensions of the geometry element. This implementation always returns 0 as a GeomPoint is not parametric.
        Specified by:
        getParDimension in interface GeomElement<GeomPoint>
        Returns:
        The number of parametric dimensions of this geometry element.
      • get

        public Parameter<javax.measure.quantity.Length> get​(int i)
        Returns the value of a Parameter from this point.
        Parameters:
        i - the dimension index.
        Returns:
        the value of the parameter at i.
        Throws:
        java.lang.IndexOutOfBoundsException - (i < 0) || (i ≥ getPhyDimension())
      • getValue

        public abstract double getValue​(int i)
        Returns the value of a coordinate in this point as a double, stated in this point's unit.
        Parameters:
        i - the dimension index.
        Returns:
        the value of the Parameter at i.
        Throws:
        java.lang.IndexOutOfBoundsException - (i < 0) || (i ≥ getPhyDimension())
      • getValue

        public abstract double getValue​(int i,
                                        javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
        Returns the value of a coordinate in this point as a double, stated in the specified unit.
        Parameters:
        i - the dimension index.
        unit - the unit to return the value in. May not be null.
        Returns:
        the value of the Parameter at i in the specified unit.
        Throws:
        java.lang.IndexOutOfBoundsException - (i < 0) || (i ≥ dimension())
      • getX

        public double getX()
        Return the X-coordinate of this point as a double, stated in this point's unit.
        Specified by:
        getX in interface XYPoint
        Returns:
        the value of the X-coordinate in the current units.
      • getY

        public double getY()
        Return the Y-coordinate of this point as a double, stated in this point's unit.
        Specified by:
        getY in interface XYPoint
        Returns:
        the value of the Y-coordinate in the current units.
      • getZ

        public double getZ()
        Return the Z-coordinate of this point as a double, stated in this point's unit.
        Returns:
        the value of the Z-coordinate in the current units.
      • normSqValue

        public abstract double normSqValue()
        Returns the square of the Euclidean norm, magnitude, or length value of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself). This is slightly faster than calling normValue if the squared value is all that is needed.
        Returns:
        this.normSq().getValue().
        See Also:
        normValue()
      • normSq

        public Parameter<javax.measure.quantity.Area> normSq()
        Returns the square of the Euclidean norm, magnitude, or length of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself). This is slightly faster than calling normValue if the squared value is all that is needed.
        Returns:
        this · this.
        See Also:
        norm()
      • normValue

        public double normValue()
        Returns the norm(), magnitude, or length value of the vector from the origin to this point (square root of the dot product of the origin-to-this-point vector and itself).
        Returns:
        this.norm().doubleValue().
        See Also:
        normSqValue()
      • norm

        public Parameter<javax.measure.quantity.Length> norm()
        Returns the Euclidian norm, magnitude, or length of the vector from the origin to this point (square root of the dot product of the origin-to-this-point vector and itself).
        Returns:
        sqrt(this · this).
        See Also:
        normValue()
      • plus

        public abstract Point plus​(GeomPoint that)
        Returns the sum of this point with the one specified. The unit of the output point will be the units of this point.
        Parameters:
        that - the point to be added. May not be null.
        Returns:
        this + that.
        Throws:
        DimensionException - if point dimensions are different.
      • plus

        public abstract Point plus​(Parameter<javax.measure.quantity.Length> that)
        Adds the specified parameter to each component of this point. The unit of the output point will be the units of this point.
        Parameters:
        that - the parameter to be added to each component of this point. May not be null.
        Returns:
        this + that.
      • minus

        public abstract Point minus​(GeomPoint that)
        Returns the difference between this point and the one specified. The unit of the output point will be the units of this point.
        Parameters:
        that - the point to be subtracted from this point. May not be null.
        Returns:
        this - that.
        Throws:
        DimensionException - if point dimensions are different.
      • minus

        public abstract Point minus​(Parameter<javax.measure.quantity.Length> that)
        Subtracts the specified parameter from each component of this point. The unit of the output point will be the units of this point.
        Parameters:
        that - the parameter to be subtracted from each component of this point. May not be null.
        Returns:
        this - that.
      • opposite

        public abstract Point opposite()
        Returns the negation of this point (all the values of each dimension negated).
        Returns:
        -this
      • times

        public abstract Point times​(double k)
        Returns the product of this point with the specified coefficient.
        Parameters:
        k - the coefficient multiplier.
        Returns:
        this · k
      • times

        public Point times​(Parameter<javax.measure.quantity.Dimensionless> k)
        Returns the product of this point with the specified dimensionless Parameter.
        Parameters:
        k - the dimensionless Parameter multiplier. May not be null.
        Returns:
        this · k
      • divide

        public Point divide​(double divisor)
        Returns this point with each element divided by the specified divisor.
        Parameters:
        divisor - the divisor.
        Returns:
        this / divisor.
      • divide

        public Point divide​(Parameter<javax.measure.quantity.Dimensionless> divisor)
        Returns this point with each element divided by the specified dimensionless Parameter.
        Parameters:
        divisor - the dimensionless Parameter divisor. May not be null.
        Returns:
        this / divisor.
      • distanceSq

        public Parameter<javax.measure.quantity.Area> distanceSq​(GeomPoint that)
        Return the square of the Euclidian distance between this point and the one specified. This is slightly faster than calling distance if the squared value is all that you need.
        Parameters:
        that - The point to determine the distance squared from this point to. May not be null.
        Returns:
        the distance squared from this point to the one specified.
        See Also:
        distance(geomss.geom.GeomPoint)
      • distanceSqValue

        public double distanceSqValue​(GeomPoint that)
        Return the Euclidian distance squared between this point and the one specified as a double. This is slightly faster than calling distance if the squared value is all that you need.
        Parameters:
        that - The point to determine the distance squared from this point to. May not be null.
        Returns:
        the distance squared from this point to the one specified.
        See Also:
        distanceValue(geomss.geom.GeomPoint)
      • distance

        public Parameter<javax.measure.quantity.Length> distance​(GeomPoint that)
        Return the Euclidian distance between this point and the one specified.
        Parameters:
        that - The point to determine the distance from this point to. May not be null.
        Returns:
        the distance from this point to the one specified.
        See Also:
        distanceSq(geomss.geom.GeomPoint)
      • distanceValue

        public double distanceValue​(GeomPoint that)
        Return the Euclidian distance between this point and the one specified as a double.
        Parameters:
        that - The point to determine the distance from this point to. May not be null.
        Returns:
        the distance from this point to the one specified.
        See Also:
        distanceSqValue(geomss.geom.GeomPoint)
      • min

        public Point min​(GeomPoint that)
        Returns a point consisting of the minimum value in each dimension between this point and the input point. This is used to find points that bound a geometry.
        Parameters:
        that - The point being compared with this one for minimum values in each dimension. May not be null.
        Returns:
        A point consisting of the minimum value in each dimension between this point and the input point.
      • max

        public Point max​(GeomPoint that)
        Returns a point consisting of the maximum value in each dimension between this point and the input point. This is used to find points that bound a geometry.
        Parameters:
        that - The point being compared with this one for maximum values in each dimension. May not be null.
        Returns:
        A point consisting of the maximum value in each dimension between this point and the input point.
      • getBoundsMin

        public Point getBoundsMin()
        Return the coordinate point representing the minimum bounding box corner (e.g.: min X, min Y, min Z).
        Specified by:
        getBoundsMin in interface GeomElement<GeomPoint>
        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).
        Specified by:
        getBoundsMax in interface GeomElement<GeomPoint>
        Returns:
        The maximum bounding box coordinate for this geometry element.
      • getLimitPoint

        public GeomPoint getLimitPoint​(int dim,
                                       boolean max,
                                       double tol)
        Returns the most extreme point, either minimum or maximum, in the specified coordinate direction on this geometry element. This implementation always returns this point's coordinate.
        Specified by:
        getLimitPoint in interface GeomElement<GeomPoint>
        Parameters:
        dim - An index indicating the dimension to find the min/max point for (0=X, 1=Y, 2=Z, etc).
        max - Set to true to return the maximum value, false to return the minimum.
        tol - Fractional tolerance to refine the min/max point position to if necessary.
        Returns:
        The point found on this element that is the min or max in the specified coordinate direction.
        See Also:
        getBoundsMin(), getBoundsMax()
      • getNumberOfPoints

        public int getNumberOfPoints()
        Return the total number of points in this geometry element. This implementation always returns 1.
        Specified by:
        getNumberOfPoints in interface PointGeometry<GeomPoint>
        Returns:
        The total number of points in this geometry element.
      • isValid

        public boolean isValid()
        Return true if this point contains valid and finite numerical components. A value of false will be returned if any of the coordinate values are NaN or Inf.
        Specified by:
        isValid in interface GeomElement<GeomPoint>
        Returns:
        true if this geometry element contains valid and finite data.
      • copyToReal

        public abstract Point copyToReal()
        Return a copy of this object with any transformations or subranges removed (applied).
        Specified by:
        copyToReal in interface GeomElement<GeomPoint>
        Returns:
        A copy of this object with any transformations removed (applied).
      • copy

        public abstract GeomPoint copy()
        Returns a copy of this GeomPoint instance allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface GeomElement<GeomPoint>
        Returns:
        an identical and independent copy of this point.
      • toVector3D

        public Vector3D<javax.measure.quantity.Length> toVector3D()
        Returns a Vector3D representation of this point if possible.
        Returns:
        A Vector3D that is equivalent to this point
        Throws:
        DimensionException - if this point has any number of dimensions other than 3.
      • toParameterVector

        public ParameterVector<javax.measure.quantity.Length> toParameterVector()
        Returns a ParameterVector representation of this point.
        Returns:
        A ParameterVector that is equivalent to this point
      • toGeomVector

        public Vector<javax.measure.quantity.Length> toGeomVector()
        Returns a GeomVector representation of this point.
        Returns:
        A GeomVector that is equivalent to this point
      • toFloat64Vector

        public abstract Float64Vector toFloat64Vector()
        Returns the values stored in this point, stated in the current units, as a Float64Vector.
        Returns:
        A Float64Vector containing the values stored in this point in the current units.
      • toArray

        public double[] toArray()
        Returns the values stored in this point as a Java array, stated in the current units.
        Returns:
        A new array with the point values copied into it.
      • toArray

        public double[] toArray​(double[] array)
        Returns the values stored in this point, stated in the current units stored in the input Java array.
        Parameters:
        array - An existing array that has at least as many elements as the physical dimension of this point.
        Returns:
        A reference to the input array after the point values have been copied over to it.
        See Also:
        GeomElement.getPhyDimension()
      • toText

        public javolution.text.Text toText()
        Returns the text representation of this geometry element that consists of the name followed by the coordinate values. For example:
           {aPoint = {10 ft, -3 ft, 4.56 ft}}
         
        If there is no name, then the output looks like this:
           {10 ft, -3 ft, 4.56 ft}
         
        Specified by:
        toText in interface GeomElement<GeomPoint>
        Overrides:
        toText in class AbstractGeomElement<GeomPoint>
        Returns:
        the text representation of this geometry element.
      • isApproxEqual

        public boolean isApproxEqual​(GeomPoint obj)
        Compares this point against the specified point for approximate equality (coordinate values approximately equal to this one to within the numerical roundoff tolerance).
        Parameters:
        obj - The GeomPoint object to compare with.
        Returns:
        true if this point is approximately identical to that point; false otherwise.
      • isApproxEqual

        public boolean isApproxEqual​(GeomPoint obj,
                                     Parameter<javax.measure.quantity.Length> tol)
        Compares this point against the specified point for approximate equality (coordinate values approximately equal to this one to within the numerical roundoff tolerance).
        Parameters:
        obj - The GeomPoint object to compare with.
        tol - The amount use to define approximate equality. If null is passed, exact numerical equality will be required.
        Returns:
        true if this point is approximately identical to that point; false otherwise.