05 - Coordinates, angles and units¶
This chapter lists the coordinate system, angles and units used by LESS, for reference while building scenes.
Coordinate system¶
The origin is at the north-west corner of the ground, with Z pointing up:
| Axis | Direction | Unit |
|---|---|---|
| X | East | m |
| Y | South | m |
| Z | Up | m |
scene.size sets the horizontal extent of the ground, which runs from (0, 0) to (size_x, size_y) in the XY plane:
import less
scene = less.Scene()
scene.size = 50.0 # 50 m × 50 m
scene.size = (100, 50) # 100 m east–west, 50 m north–south
In image results the first row is north and the first column is west, consistent with these coordinates.
Placing objects¶
Object positions (x, y, z) use the same coordinates; z = 0 is the ground:
scene.size = 50.0
tree = less.Object("tree", mesh=less.asset_path("FREX.obj"))
scene.add(tree, positions=[[25.0, 25.0, 0.0], # centre of the scene
[45.0, 45.0, 0.0]]) # near the south-east corner
On uneven terrain you may give only (x, y); the object is then placed on the ground at that point.
OBJ models¶
OBJ files are read as "Y up": a point (x, y, z) in the file becomes (-x, -z, y) in the scene. The front face of a triangle follows the usual OBJ convention: seen from the front, its vertices run counter-clockwise. A leaf's reflectance applies to the front face and back_reflectance to the back face; without back_reflectance both faces are the same.
Zenith angle¶
Zenith angles are measured from straight up:
| Zenith | Meaning |
|---|---|
| 0° | Straight up (nadir view) |
| 30° | Sun elevation 60° |
| 60° | Sun elevation 30° |
| 90° | Horizontal |
Azimuth angle¶
Azimuth angles start at north and increase clockwise:
| Azimuth | Direction |
|---|---|
| 0° | North (−Y) |
| 90° | East (+X) |
| 180° | South (+Y) |
| 270° | West (−X) |
The sun azimuth is the direction the sun is in, and the view azimuth is the direction the sensor is in:
scene.illumination = less.Illumination(
source=less.Sun(zenith=30, azimuth=135), # sun in the south-east
atmosphere=less.NoAtmosphere())
camera = less.Orthographic(view_zenith=30, view_azimuth=270) # oblique view from the west
Sun position from date, time and place¶
from datetime import datetime, timedelta, timezone
beijing = timezone(timedelta(hours=8))
sun = less.compute_sun_position(
latitude=39.9, longitude=116.4,
date_time=datetime(2024, 6, 21, 10, 0, tzinfo=beijing),
)
print(f"zenith {sun.sun_zenith:.1f}°, azimuth {sun.sun_azimuth:.1f}°")
A time without a time zone is taken as Coordinated Universal Time (UTC), so give local times a time zone as above.
Units¶
| Quantity | Unit |
|---|---|
| Position, distance, height | m |
| Angles | degrees |
| Wavelength | nm |
| Reflectance, transmittance, emissivity | dimensionless, 0–1 |
| Spectral irradiance | W m⁻² nm⁻¹ |
| Spectral radiance | W m⁻² sr⁻¹ nm⁻¹ |
| Object temperature | K |
Air temperature (Microclimate) |
°C |
| Relative humidity | % |
| Wind speed | m s⁻¹ |
| Leaf area density | m² m⁻³ |
| Microwave frequency | Hz |