Created
November 16, 2023 03:10
-
-
Save inoook/922cfc85befc63533055cedd6f930e56 to your computer and use it in GitHub Desktop.
Revisions
-
inoook created this gist
Nov 16, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ /// <summary> /// Equirectangular座標から球面の3D座標に変換する関数 /// </summary> /// <param name="lon">経度(0から1の範囲)</param> /// <param name="lat">緯度(0から1の範囲)</param> /// <returns></returns> Vector3 EquirectangularToSphereCoordinates(float lon, float lat) { float u = lon; float v = lat; // Equirectangular座標から球面の3D座標に変換 Vector3 sphereCoord = new Vector3( -Mathf.Cos(u * 2 * Mathf.PI) * Mathf.Sin(v * Mathf.PI), -Mathf.Cos(v * Mathf.PI), Mathf.Sin(u * 2 * Mathf.PI) * Mathf.Sin(v * Mathf.PI) ); return sphereCoord; }