|
Photon Engine 2.0.0-beta
A physically based renderer.
|
A sphere in 3-D space. More...
#include <TSphere.h>
Public Member Functions | |
| TSphere ()=default | |
| TSphere (T radius) | |
| bool | isIntersecting (const TLineSegment< T > &segment, real *out_hitT) const |
Checks whether the segment is interseting with this sphere. | |
| bool | isInside (const TVector3< T > &point) const |
Same as isIntersecting(), except the cost is slightly higher to reduce numerical error. | |
| T | getRadius () const |
| T | getArea () const |
| TAABB3D< T > | getAABB () const |
| bool | mayOverlapVolume (const TAABB3D< T > &volume) const |
| Conservatively checks whether this sphere overlaps a volume. By conservative, it means true can be returned even though the sphere does not overlap the volume; but if it actually does, true must be returned. The test considers the sphere as hollow and the volume is solid. | |
| T | uniformSurfaceSamplePdfA () const |
| TVector2< T > | surfaceToLatLong01 (const TVector3< T > &surface) const |
| TVector2< T > | latLong01ToPhiTheta (const TVector2< T > &latLong01) const |
| TVector3< T > | latLong01ToSurface (const TVector2< T > &latLong01) const |
| TVector2< T > | surfaceToPhiTheta (const TVector3< T > &surface) const |
| Map Cartesian to spherical coordinates on the surface of the sphere. | |
| TVector3< T > | phiThetaToSurface (const TVector2< T > &phiTheta) const |
| Map spherical to Cartesian coordinates on the surface of the sphere. | |
| template<typename SurfaceToUv > | |
| std::pair< TVector3< T >, TVector3< T > > | surfaceDerivativesWrtUv (const TVector3< T > &surface, SurfaceToUv surfaceToUv, T hInRadians=to_radians< T >(1)) const |
| Calculate dPdU and dPdV with finite difference. | |
Map 2-D sample to a position on the surface. | |
| TVector3< T > | sampleToSurfaceArchimedes (const std::array< T, 2 > &sample) const |
| TVector3< T > | sampleToSurfaceArchimedes (const std::array< T, 2 > &sample, T *out_pdfA) const |
| TVector3< T > | sampleToSurfaceAbsCosThetaWeighted (const std::array< T, 2 > &sample) const |
| TVector3< T > | sampleToSurfaceAbsCosThetaWeighted (const std::array< T, 2 > &sample, T *out_pdfA) const |
Static Public Member Functions | |
| static TSphere | makeUnit () |
A sphere in 3-D space.
The center of the sphere is at the origin.
|
default |
|
inlineexplicit |
| radius | Radius of the sphere. |
|
inline |
|
inline |
|
inline |
|
inline |
Same as isIntersecting(), except the cost is slightly higher to reduce numerical error.
|
inline |
Checks whether the segment is interseting with this sphere.
| segment | The line section to intersect with. | |
| [out] | out_hitT | The parametric distance of the hit point for segment. |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
Conservatively checks whether this sphere overlaps a volume. By conservative, it means true can be returned even though the sphere does not overlap the volume; but if it actually does, true must be returned. The test considers the sphere as hollow and the volume is solid.
|
inline |
Map spherical to Cartesian coordinates on the surface of the sphere.
|
inline |
The mapped positions are weighted according to the cosine of the zenith angle.
| sample | Uniform 2-D sample in [0, 1]. |
|
inline |
An overload with PDF.
| [out] | out_pdfA | Area domain PDF of sampling this surface position. |
|
inline |
A common mapping method that is based on Archimedes' derivation that the horizontal slices of a sphere have equal area. The mapped positions are distributed uniformly if the sample is uniform. For a unit sphere, this method effectively generates normalized directions.
| sample | Uniform 2-D sample in [0, 1]. |
|
inline |
An overload with PDF.
| [out] | out_pdfA | Area domain PDF of sampling this surface position. |
|
inline |
Calculate dPdU and dPdV with finite difference.
This is a partial derivatives calculator for arbitrary UV maps; however, as it is only a finite difference approximation, artifacts can occur around the discontinuities of the underlying UV mapping.
| surface | Coordinates of the point of interest on the surface. |
| surfaceToUv | A mapper that maps surface coordinates to UV. |
| hInRadians | Half inverval in radians used in the finite difference. Should within (0, pi/4]. |
|
inline |
|
inline |
Map Cartesian to spherical coordinates on the surface of the sphere.
|
inline |