Methods
(static) cart2rad(p, c0) → {object}
See https://keisan.casio.com/exec/system/1359533867 and https://en.wikipedia.org/wiki/Spherical_coordinate_system
Parameters:
Name | Type | Description |
---|---|---|
p |
object | position {x, y, z} |
c0 |
object | center (x, y, z) |
- Source:
Returns:
{lon, lat, r}
- Type
- object
(static) castPosition(eye, dir, r, c0) → {object}
Find out sphere intersect point with ray.
Parameters:
Name | Type | Description |
---|---|---|
eye |
vec3 | camera position in world |
dir |
vec3 | direction norm |
r |
float | sphere radius |
c0 |
vec3 | shpere center position in world |
- Source:
Returns:
(x, y, z, w): intersect position in world, w = distance from eye
- Type
- object
(static) distSphere(eye, l, r, cent)
Vector distance to orignal point. See https://en.wikipedia.org/wiki/Line%E2%80%93sphere_intersection
Parameters:
Name | Type | Description |
---|---|---|
eye |
vec3 | camera position in world |
l |
vec3 | direction, will be normalized |
r |
float | sphere radius |
cent |
vec3 | shpere center position in world |
- Source:
Returns:
distance
(static) loadImgTile(id, xyz)
Set img (#id)'s src as tile of OSM X/Y/Z. src = 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'
Parameters:
Name | Type | Description |
---|---|---|
id |
string | img id |
xyz |
object | {x, y, z} |
- Source:
(static) normalize(v, v0) → {vec3}
Normalize vector v - v0
Parameters:
Name | Type | Description |
---|---|---|
v |
vec3 | |
v0 |
vec3 |
- Source:
Returns:
norm [x, y, z]
- Type
- vec3
(static) osmGlobeTiles(OSM, a) → {Float32Array}
Step through all tile girds, then change longitude / latitude to Cartesian, with prime meridian at z = 0, x = R, y = 0, to north, negative z to the east hemishphere.
Parameters:
Name | Type | Description |
---|---|---|
OSM |
number | Z level |
a |
number | model's radius see https://en.wikipedia.org/wiki/Mercator_projection#Cylindrical_projections |
- Source:
Returns:
the verices buffer For z = 6, the closest points include:
left 2973: -48.77, 48.93, 495.20 2976: -49.01, 0, 497.59 2979: -48.77, -48.93, 495.20center 3168: 3.0e-14, 0, 500 right 3549: 97.08, 48.93, 488.04 3552: 97.55, 0, 490.39 3555: 97.08, -48.93, 488.04</pre>
- Type
- Float32Array
(static) pointsBuff(z, a) → {THREE.Points}
Build points buffer, convert all tile grid into world position.
Parameters:
Name | Type | Description |
---|---|---|
z |
number | zoom level of OSM XYZ |
a |
number | a of Mercator Projection, see <a href=https://en.wikipedia.org/wiki/Mercator_projection#Cylindrical_projections'>Mercator Projection |
- Source:
Returns:
points
- Type
- THREE.Points
(static) rad2cart(long, lat, a) → {object}
Convert long-lat to world position in Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
long |
number | longitude in radians ( degree *= pi / 180) |
lat |
number | latitude in radians ( degree *= pi / 180) |
a |
number | a of Mercator Projection, see <a href=https://en.wikipedia.org/wiki/Mercator_projection#Cylindrical_projections'>Mercator Projection |
- Source:
Returns:
x, y, z in world
- Type
- object
(static) stepz(d, a) → {int}
Find OMS zoom level according to distance.
Parameters:
Name | Type | Description |
---|---|---|
d |
number | distance |
a |
number |
- Source:
Returns:
z
- Type
- int
(static) urlTile(x, y, z)
Get tile url of OSM X/Y/Z. url = 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'
Parameters:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number | |
z |
number |
- Source: