photonmap.Common.Math

Functions

denormalize(→ int)

Convert a value from range (0 - 1) to (0 - 255)

sphericalToCartesian(theta, phi, x_seg, y_seg)

Convert the quaternion of object from angle(theta, phi) to Vec3(x,y,z)

crossVector(a, b)

Calculate the cross product of two vector

orthonormalBasis(n)

Calculate the axis orthogonal from the vector normal

geoHemisphere(centre, normal, rayon)

Generate the geometry of a hemisphere

averageVector(listVectors)

Calculate the average vector of a list

Module Contents

photonmap.Common.Math.denormalize(f: float) int[source]

Convert a value from range (0 - 1) to (0 - 255)

Parameters

f: float

The value to convert

photonmap.Common.Math.sphericalToCartesian(theta, phi, x_seg, y_seg)[source]

Convert the quaternion of object from angle(theta, phi) to Vec3(x,y,z)

Parameters

theta: float

The angle theta

phi: float

The angle phi

x_seg: int

The number of x segment

y_seg: int

The number of y segment

photonmap.Common.Math.crossVector(a, b)[source]

Calculate the cross product of two vector

Parameters

a: Vec3

The first vector

b: Vec3

The second vector

photonmap.Common.Math.orthonormalBasis(n)[source]

Calculate the axis orthogonal from the vector normal

Parameters

n: Vec3

The normal vector (first axe)

Returns

t: Vec3

The second axe

b: Vec3

The third axe

photonmap.Common.Math.geoHemisphere(centre, normal, rayon)[source]

Generate the geometry of a hemisphere

Parameters

centre: Vec3

The center of sphere

normal: Vec3

The normal vector

rayon: float

The radius of sphere

Returns

A Shape PlantGL

photonmap.Common.Math.averageVector(listVectors)[source]

Calculate the average vector of a list

Parameters

listVectors: array

The list of vector