public double3 GetAboveGroundObserverCubePoint() { var localPos = (double3)(float3)transform.InverseTransformPoint(WorldObserver); var localAlt = math.length(localPos); var localHeight = GetLocalHeight(localPos); var cubePoint = SgtTerrainTopology.VectorToUnitCube(localPos); if (localAlt > localHeight && localHeight > 0.0) { cubePoint *= localAlt / localHeight; } return(cubePoint); }
public double3 GetSpherePoint() { var localPos = (double3)(float3)transform.InverseTransformPoint(WorldObserver); var localAlt = math.length(localPos); var localHeight = GetLocalHeight(localPos); var localDist = math.abs(localAlt - localHeight) / radius; for (var i = 0; i < distances.Count; i++) { var distance = detail * math.pow(0.5, 1 + i); var frac = math.saturate(localDist / distance); distance *= math.cos(math.asin(frac)); distances[i] = distance; } return(SgtTerrainTopology.Unwarp(SgtTerrainTopology.VectorToUnitCube(SgtTerrainTopology.Untilt(localPos)))); }