Class UVMapping


  • public final class UVMapping
    extends java.lang.Object
    A utility class for mapping a point onto a spherical coordinate system and vice versa
    Since:
    18246
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static double TWO_PI  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private UVMapping()  
    • Method Detail

      • getTextureCoordinate

        public static java.awt.geom.Point2D.Double getTextureCoordinate​(Vector3D vector)
        Returns the point of the texture image that is mapped to the given point in 3D space (given as Vector3D) See the Wikipedia article on UV mapping.
        Parameters:
        vector - the vector to which the texture point is mapped
        Returns:
        a point on the texture image somewhere in the rectangle between (0, 0) and (1, 1)
      • getVector

        public static Vector3D getVector​(double u,
                                         double v)
        For a given point of the texture (i.e. the image), return the point in 3D space where the point of the texture is mapped to (as Vector3D).
        Parameters:
        u - x-coordinate of the point on the texture (in the range between 0 and 1, from left to right)
        v - y-coordinate of the point on the texture (in the range between 0 and 1, from top to bottom)
        Returns:
        the vector from the origin to where the point of the texture is mapped on the sphere