|
GigaSphere
360 Tiled panorama engine
|
Utility class for mathematical operations related to panoramic spheres. Provides conversions between different coordinate systems: longitude/latitude, 3D vectors, UV coordinates, and angles. More...
Static Public Member Functions | |
| static Vector3 | FromLonLat (float longitude, float latitude) |
| Converts longitude and latitude (in degrees) to a normalized direction vector on the unit sphere. | |
| static Vector3 | FromLonLatRadians (float longitude, float latitude) |
| Converts longitude and latitude (in radians) to a normalized direction vector on the unit sphere. | |
| static void | ToLonLat (Vector3 direction, out float longitude, out float latitude) |
| Converts a direction vector to longitude and latitude (in degrees). | |
| static void | ToLonLatRadians (Vector3 direction, out float longitude, out float latitude) |
| Converts a direction vector to longitude and latitude (in radians). | |
| static Vector2 | ToLonLatVector (Vector3 direction) |
| Converts a direction vector to a Vector2 containing longitude and latitude in degrees. | |
| static Vector3 | FromUV (Vector2 uv) |
| Converts UV coordinates on a 2:1 equirectangular panorama texture to a direction vector on the unit sphere. | |
| static Vector3 | FromUV (float u, float v) |
| Converts UV coordinates on a 2:1 equirectangular panorama texture to a direction vector on the unit sphere. | |
| static Vector2 | ToUV (Vector3 direction) |
| Converts a direction vector to UV coordinates on a 2:1 equirectangular panorama texture. | |
| static Vector3 | FromAngles (float horizontalAngle, float verticalAngle) |
| Converts horizontal and vertical angles to a direction vector. | |
| static void | ToAngles (Vector3 direction, out float horizontalAngle, out float verticalAngle) |
| Converts a direction vector to horizontal and vertical angles. | |
| static Vector2 | ToAnglesVector (Vector3 direction) |
| Converts a direction vector to a Vector2 containing horizontal and vertical angles in degrees. | |
| static float | AngularDistance (Vector3 direction1, Vector3 direction2) |
| Calculates the angular distance (in degrees) between two direction vectors on the unit sphere. | |
| static float | AngularDistanceRadians (Vector3 direction1, Vector3 direction2) |
| Calculates the angular distance (in radians) between two direction vectors on the unit sphere. | |
| static Vector3 | SlerpDirection (Vector3 from, Vector3 to, float t) |
| Performs spherical linear interpolation (Slerp) between two direction vectors on the unit sphere. | |
| static float | NormalizeLongitude (float longitude) |
| Ensures longitude is in the range [-180, 180]. | |
| static float | ClampLatitude (float latitude) |
| Clamps latitude to the valid range [-90, 90]. | |
| static bool | IsValidUV (Vector2 uv) |
| Validates if UV coordinates are within the valid range [0, 1]. | |
| static Vector2 | ClampUV (Vector2 uv) |
| Clamps UV coordinates to the valid range [0, 1]. | |
| static Vector3 | OffsetDirection (Vector3 direction, float horizontalOffset, float verticalOffset) |
| Offsets a direction vector by the specified horizontal and vertical angles. | |
| static Vector3 | OffsetDirectionUV (Vector3 baseDirection, Vector2 uvOffset) |
| Creates a direction vector at a specified offset from a base direction in UV space. | |
| static Vector3[] | GenerateGrid (int horizontalCount, int verticalCount) |
| Generates a grid of direction vectors on the panorama sphere. | |
| static Vector3[] | GenerateRing (float latitude, int count) |
| Generates direction vectors in a ring pattern at a specific latitude. | |
Static Public Attributes | |
| const float | Deg2Rad = Mathf.PI / 180f |
| Degrees to radians conversion constant. | |
| const float | Rad2Deg = 180f / Mathf.PI |
| Radians to degrees conversion constant. | |
Properties | |
| static Vector3 | DirectionFront [get] |
| Gets the direction vector for front/center of the panorama. | |
| static Vector3 | DirectionBack [get] |
| Gets the direction vector for back of the panorama. | |
| static Vector3 | DirectionRight [get] |
| Gets the direction vector for right of the panorama. | |
| static Vector3 | DirectionLeft [get] |
| Gets the direction vector for left of the panorama. | |
| static Vector3 | DirectionTop [get] |
| Gets the direction vector for top (zenith) of the panorama. | |
| static Vector3 | DirectionBottom [get] |
| Gets the direction vector for bottom (nadir) of the panorama. | |
Utility class for mathematical operations related to panoramic spheres. Provides conversions between different coordinate systems: longitude/latitude, 3D vectors, UV coordinates, and angles.
|
inlinestatic |
Calculates the angular distance (in degrees) between two direction vectors on the unit sphere.
| direction1 | First direction vector. |
| direction2 | Second direction vector. |
|
inlinestatic |
Calculates the angular distance (in radians) between two direction vectors on the unit sphere.
| direction1 | First direction vector. |
| direction2 | Second direction vector. |
|
inlinestatic |
Clamps latitude to the valid range [-90, 90].
| latitude | Latitude in degrees. |
|
inlinestatic |
Clamps UV coordinates to the valid range [0, 1].
| uv | UV coordinates to clamp. |
|
inlinestatic |
Converts horizontal and vertical angles to a direction vector.
| horizontalAngle | Horizontal angle in degrees (yaw). 0 is forward (Z+), positive rotates right. |
| verticalAngle | Vertical angle in degrees (pitch). 0 is horizontal, positive looks up, negative looks down. |
This matches the camera configuration in LocationInfo (openHorizontalAngle, openVerticalAngle).
|
inlinestatic |
Converts longitude and latitude (in degrees) to a normalized direction vector on the unit sphere.
| longitude | Longitude in degrees. Range: [-180, 180] where 0 is front, -180/180 is back, -90 is left, 90 is right. |
| latitude | Latitude in degrees. Range: [-90, 90] where 0 is equator, 90 is top (zenith), -90 is bottom (nadir). |
Unity coordinate system:
|
inlinestatic |
Converts longitude and latitude (in radians) to a normalized direction vector on the unit sphere.
| longitude | Longitude in radians. Range: [-PI, PI]. |
| latitude | Latitude in radians. Range: [-PI/2, PI/2]. |
|
inlinestatic |
Converts UV coordinates on a 2:1 equirectangular panorama texture to a direction vector on the unit sphere.
| u | Horizontal coordinate [0, 1]. 0 is left edge (-180°), 1 is right edge (+180°). |
| v | Vertical coordinate [0, 1]. 0 is top edge (+90°), 1 is bottom edge (-90°). |
|
inlinestatic |
Converts UV coordinates on a 2:1 equirectangular panorama texture to a direction vector on the unit sphere.
| uv | UV coordinates where X and Y are in range [0, 1]. U=0 is left edge (-180°), U=1 is right edge (+180°). V=0 is top edge (+90°), V=1 is bottom edge (-90°). |
This matches the coordinate system used in HotspotEditorWindow for panorama rendering.
|
inlinestatic |
Generates a grid of direction vectors on the panorama sphere.
| horizontalCount | Number of points horizontally. |
| verticalCount | Number of points vertically. |
Useful for creating evenly distributed hotspots or test patterns.
|
inlinestatic |
Generates direction vectors in a ring pattern at a specific latitude.
| latitude | Latitude in degrees for the ring. |
| count | Number of points in the ring. |
Useful for creating circular patterns of hotspots around the panorama.
|
inlinestatic |
Validates if UV coordinates are within the valid range [0, 1].
| uv | UV coordinates to validate. |
|
inlinestatic |
Ensures longitude is in the range [-180, 180].
| longitude | Longitude in degrees. |
|
inlinestatic |
Offsets a direction vector by the specified horizontal and vertical angles.
| direction | Base direction vector. |
| horizontalOffset | Horizontal offset in degrees. |
| verticalOffset | Vertical offset in degrees. |
|
inlinestatic |
Creates a direction vector at a specified offset from a base direction in UV space.
| baseDirection | Base direction vector. |
| uvOffset | Offset in UV coordinates (normalized [0-1] space). |
Useful for positioning hotspots relative to each other in panorama space.
|
inlinestatic |
Performs spherical linear interpolation (Slerp) between two direction vectors on the unit sphere.
| from | Starting direction vector. |
| to | Ending direction vector. |
| t | Interpolation parameter. Range: [0, 1]. |
|
inlinestatic |
Converts a direction vector to horizontal and vertical angles.
| direction | The direction vector (will be normalized internally). |
| horizontalAngle | Output horizontal angle in degrees. Range: [-180, 180]. |
| verticalAngle | Output vertical angle in degrees. Range: [-90, 90]. |
|
inlinestatic |
Converts a direction vector to a Vector2 containing horizontal and vertical angles in degrees.
| direction | The direction vector. |
|
inlinestatic |
Converts a direction vector to longitude and latitude (in degrees).
| direction | The direction vector on the sphere (will be normalized internally). |
| longitude | Output longitude in degrees. Range: [-180, 180]. |
| latitude | Output latitude in degrees. Range: [-90, 90]. |
|
inlinestatic |
Converts a direction vector to longitude and latitude (in radians).
| direction | The direction vector on the sphere (will be normalized internally). |
| longitude | Output longitude in radians. Range: [-PI, PI]. |
| latitude | Output latitude in radians. Range: [-PI/2, PI/2]. |
|
inlinestatic |
Converts a direction vector to a Vector2 containing longitude and latitude in degrees.
| direction | The direction vector on the sphere. |
|
inlinestatic |
Converts a direction vector to UV coordinates on a 2:1 equirectangular panorama texture.
| direction | The direction vector on the sphere (will be normalized internally). |
|
static |
Degrees to radians conversion constant.
|
static |
Radians to degrees conversion constant.
|
staticget |
Gets the direction vector for back of the panorama.
|
staticget |
Gets the direction vector for bottom (nadir) of the panorama.
|
staticget |
Gets the direction vector for front/center of the panorama.
|
staticget |
Gets the direction vector for left of the panorama.
|
staticget |
Gets the direction vector for right of the panorama.
|
staticget |
Gets the direction vector for top (zenith) of the panorama.