Class Projector



  • public final class Projector
    extends java.lang.Object
    The class Projector projects points in 3D space to 2D space.
    • Constructor Summary

      Constructors 
      Constructor Description
      Projector​()
      The constructor of Projector.
    • Constructor Detail

      • Projector

        public Projector​()
        The constructor of Projector.
    • Method Detail

      • setProjectionArea

        public void setProjectionArea​(java.awt.Rectangle r)
        Sets the projection area.
        Parameters:
        r - the projection area
      • setRotationAngle

        public void setRotationAngle​(float angle)
        Sets the rotation angle.
        Parameters:
        angle - the rotation angle in degrees
      • getRotationAngle

        public float getRotationAngle​()
        Gets current rotation angle.
        Returns:
        the rotation angle in degrees.
      • getSinRotationAngle

        public float getSinRotationAngle​()
        Gets the sine of rotation angle.
        Returns:
        the sine of rotation angle
      • getCosRotationAngle

        public float getCosRotationAngle​()
        Gets the cosine of rotation angle.
        Returns:
        the cosine of rotation angle
      • setElevationAngle

        public void setElevationAngle​(float angle)
        Sets the elevation angle.
        Parameters:
        angle - the elevation angle in degrees
      • getElevationAngle

        public float getElevationAngle​()
        Gets current elevation angle.
        Returns:
        the elevation angle in degrees.
      • getSinElevationAngle

        public float getSinElevationAngle​()
        Gets the sine of elevation angle.
        Returns:
        the sine of elevation angle
      • getCosElevationAngle

        public float getCosElevationAngle​()
        Gets the cosine of elevation angle.
        Returns:
        the cosine of elevation angle
      • setDistance

        public void setDistance​(float new_distance)
        Sets the projector distance.
        Parameters:
        new_distance - the new distance
      • getDistance

        public float getDistance​()
        Gets the projector distance.
        Returns:
        the projector distance
      • setXScaling

        public void setXScaling​(float scaling)
        Sets the scaling factor in x direction.
        Parameters:
        scaling - the scaling factor
      • getXScaling

        public float getXScaling​()
        Gets the scaling factor in x direction.
        Returns:
        the scaling factor
      • setYScaling

        public void setYScaling​(float scaling)
        Sets the scaling factor in y direction.
        Parameters:
        scaling - the scaling factor
      • getYScaling

        public float getYScaling​()
        Gets the scaling factor in y direction.
        Returns:
        the scaling factor
      • setZScaling

        public void setZScaling​(float scaling)
        Sets the scaling factor in z direction.
        Parameters:
        scaling - the scaling factor
      • getZScaling

        public float getZScaling​()
        Gets the scaling factor in z direction.
        Returns:
        the scaling factor
      • setScaling

        public void setScaling​(float x,
                               float y,
                               float z)
        Sets the scaling factor in all direction.
        Parameters:
        x - the scaling factor in x direction
        y - the scaling factor in y direction
        z - the scaling factor in z direction
      • setScaling

        public void setScaling​(float scaling)
        Sets the same scaling factor for all direction.
        Parameters:
        scaling - the scaling factor
      • set2DScaling

        public void set2DScaling​(float scaling)
        Sets the 2D scaling factor.
        Parameters:
        scaling - the scaling factor
      • setX2DScaling

        public void setX2DScaling​(float scaling)
        Sets the x 2D scaling factor.
        Parameters:
        scaling - the x scaling factor
      • setY2DScaling

        public void setY2DScaling​(float scaling)
        Sets the 2D scaling factor.
        Parameters:
        scaling - the scaling factor
      • getX2DScaling

        public float getX2DScaling​()
        Gets the x 2D scaling factor.
        Returns:
        the x scaling factor
      • getY2DScaling

        public float getY2DScaling​()
        Gets the x 2D scaling factor.
        Returns:
        the x scaling factor
      • set2DTranslation

        public void set2DTranslation​(int x,
                                     int y)
        Sets the 2D translation.
        Parameters:
        x - the x translation
        y - the y translation
      • set2D_xTranslation

        public void set2D_xTranslation​(int x)
        Sets the 2D x translation.
        Parameters:
        x - the x translation
      • get2D_xTranslation

        public int get2D_xTranslation​()
        Gets the 2D x translation.
        Returns:
        the x translation
      • set2D_yTranslation

        public void set2D_yTranslation​(int y)
        Sets the 2D y translation.
        Parameters:
        y - the y translation
      • get2D_yTranslation

        public int get2D_yTranslation​()
        Gets the 2D y translation.
        Returns:
        the y translation
      • project

        public final java.awt.Point project​(float x,
                                            float y,
                                            float z)
        Projects 3D points.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        z - the z coordinate
        Returns:
        Projected point
      • projectAL

        public double[] projectAL​(float x1,
                                  float y1,
                                  float z1,
                                  float x2,
                                  float y2,
                                  float z2)
        Project angle and length from two points
        Parameters:
        x1 - Point 1 x
        y1 - Point 1 y
        z1 - Point 1 z
        x2 - Point 2 x
        y2 - Point 2 y
        z2 - Point 2 z
        Returns:
        Angle and length
      • project_noScale

        public final java.awt.Point project_noScale​(float x,
                                                    float y,
                                                    float z)
        Projects 3D points without scaling.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        z - the z coordinate
        Returns:
        Projected point
      • setZRange

        public void setZRange​(float zmin,
                              float zmax)
      • getBounds

        public java.awt.Rectangle getBounds​()
        Get bounds
        Returns:
        Bounds rectangle
      • getBounds_noScale

        public java.awt.Rectangle getBounds_noScale​()
        Get bounds without scale
        Returns:
        Bounds rectangle
      • update2DScaling

        public void update2DScaling​()
        Update 2D scaling