- Fixed Documentation for Consistency
- Added more documentation, predominantly in the Math Library
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file geometric.h
|
||||
/// \brief \ref page_fennec_math_geometric
|
||||
/// \brief \ref fennec_math_geometric
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@@ -39,7 +39,7 @@
|
||||
///
|
||||
///
|
||||
///
|
||||
/// \page page_fennec_math_geometric Geometric
|
||||
/// \page fennec_math_geometric Geometric
|
||||
///
|
||||
/// \brief The Geometric Functions defined in the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
|
||||
///
|
||||
@@ -51,58 +51,58 @@
|
||||
/// <th style="vertical-align: top">Description
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// \ref fennec::dot(const genFType&, const genFType&) "float dot(genFType x, genFType y)" <br>
|
||||
/// \ref fennec::dot(const genDType&, const genDType&) "double dot(genDType x, genDType x)"
|
||||
/// \ref fennec::dot "float dot(genFType x, genFType y)" <br>
|
||||
/// \ref fennec::dot "double dot(genDType x, genDType x)"
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// \copydoc fennec::dot(const genFType&, const genFType&)
|
||||
/// \copydoc fennec::dot
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
|
||||
/// \ref fennec::length2(const genFType&) "float length2(genFType x)" <br>
|
||||
/// \ref fennec::length2(const genDType&) "double length2(genDType x)"
|
||||
/// \ref fennec::length2 "float length2(genFType x)" <br>
|
||||
/// \ref fennec::length2 "double length2(genDType x)"
|
||||
/// <td width="50%" style="vertical-align: top" class="odd_c">
|
||||
/// \copydoc fennec::length2(const genFType&)
|
||||
/// \copydoc fennec::length2
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// \ref fennec::length(const genFType&) "float length(genFType x)" <br>
|
||||
/// \ref fennec::length(const genDType&) "double length(genDType x)"
|
||||
/// \ref fennec::length "float length(genFType x)" <br>
|
||||
/// \ref fennec::length "double length(genDType x)"
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// \copydoc fennec::length(const genFType&)
|
||||
/// \copydoc fennec::length
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
|
||||
/// \ref fennec::distance(const genFType&, const genFType&) "float distance(genFType x, genFType y)" <br>
|
||||
/// \ref fennec::distance(const genDType&, const genDType&) "double distance(genDType x, genDType x)"
|
||||
/// \ref fennec::distance "float distance(genFType x, genFType y)" <br>
|
||||
/// \ref fennec::distance "double distance(genDType x, genDType x)"
|
||||
/// <td width="50%" style="vertical-align: top" class="odd_c">
|
||||
/// \copydoc fennec::distance(const genFType&, const genFType&)
|
||||
/// \copydoc fennec::distance
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// \ref fennec::normalize(const genFType&) "float normalize(genFType x)" <br>
|
||||
/// \ref fennec::normalize(const genDType&) "double normalize(genDType x)"
|
||||
/// \ref fennec::normalize "float normalize(genFType x)" <br>
|
||||
/// \ref fennec::normalize "double normalize(genDType x)"
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// \copydoc fennec::normalize(const genFType&)
|
||||
/// \copydoc fennec::normalize
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
|
||||
/// \ref fennec::cross(const fennec::vec3&, const fennec::vec3&) "vec3 cross(vec3 x, vec3 y)" <br>
|
||||
/// \ref fennec::cross(const fennec::dvec3&, const fennec::dvec3&) "dvec3 cross(dvec3 x, dvec3 x)"
|
||||
/// \ref fennec::cross "vec3 cross(vec3 x, vec3 y)" <br>
|
||||
/// \ref fennec::cross "dvec3 cross(dvec3 x, dvec3 x)"
|
||||
/// <td width="50%" style="vertical-align: top" class="odd_c">
|
||||
/// \copydoc fennec::cross(const fennec::vec3&, const fennec::vec3&)
|
||||
/// \copydoc fennec::cross
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// \ref fennec::faceforward(const genFType&, const genFType&, const genFType&) "genFType faceforward(genFType N, genFType I, genFType Nref)" <br>
|
||||
/// \ref fennec::faceforward(const genDType&, const genDType&, const genDType&) "genDType faceforward(genDType N, genDType I, genDType Nref)"
|
||||
/// \ref fennec::faceforward "genFType faceforward(genFType N, genFType I, genFType Nref)" <br>
|
||||
/// \ref fennec::faceforward "genDType faceforward(genDType N, genDType I, genDType Nref)"
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// \copydoc fennec::faceforward(const genFType&, const genFType&, const genFType&)
|
||||
/// \copydoc fennec::faceforward
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top" class="odd_c"> <br>
|
||||
/// \ref fennec::reflect(const genFType&, const genFType&) "genFType reflect(genFType I, genFType N)" <br>
|
||||
/// \ref fennec::reflect(const genDType&, const genDType&) "genDType reflect(genDType I, genDType N)"
|
||||
/// \ref fennec::reflect "genFType reflect(genFType I, genFType N)" <br>
|
||||
/// \ref fennec::reflect "genDType reflect(genDType I, genDType N)"
|
||||
/// <td width="50%" style="vertical-align: top" class="odd_c">
|
||||
/// \copydoc fennec::reflect(const genFType&, const genFType&)
|
||||
/// \copydoc fennec::reflect
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// \ref fennec::refract(const genFType&, const genFType&, float) "genFType refract(genFType N, genFType I, float eta)" <br>
|
||||
/// \ref fennec::refract(const genDType&, const genDType&, double) "genDType refract(genDType N, genDType I, double eta)"
|
||||
/// \ref fennec::refract "genFType refract(genFType N, genFType I, float eta)" <br>
|
||||
/// \ref fennec::refract "genDType refract(genDType N, genDType I, double eta)"
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// \copydoc fennec::refract(const genFType&, const genFType&, float)
|
||||
/// \copydoc fennec::refract
|
||||
///
|
||||
/// </table>
|
||||
///
|
||||
@@ -115,7 +115,6 @@ namespace fennec
|
||||
|
||||
// dot -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief Returns the dot product of \f$x\f$ and \f$y\f$, i.e., \f$x_0 \cdot y_0 + x_0 \cdot y_0 + \ldots\f$
|
||||
///
|
||||
@@ -135,7 +134,6 @@ constexpr genType dot(const vector<genType, i...>& x, const vector<genType, i...
|
||||
|
||||
// length2 -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief Returns the squared length of vector \f$x\f$, i.e., \f$x_0^2 + x_1^2 + \ldots\f$
|
||||
///
|
||||
@@ -153,7 +151,6 @@ constexpr genType length2(const vector<genType, i...>& x)
|
||||
|
||||
// length --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief Returns the length of vector \f$x\f$, i.e., \f$\sqrt{x_0^2 + x_1^2 + \ldots}\f$
|
||||
///
|
||||
@@ -170,7 +167,6 @@ constexpr genType length(const vector<genType, i...>& x) { return fennec::sqrt(f
|
||||
|
||||
// distance ------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief Returns the length of vector \f$x\f$, i.e., \f$\sqrt{x_0^2 + x_1^2 + \ldots}\f$
|
||||
///
|
||||
@@ -190,7 +186,6 @@ constexpr genType distance(const vector<genType, i...>& p0, const vector<genType
|
||||
|
||||
// cross ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief Returns the cross product of \f$x\f$ and \f$y\f$, i.e.,
|
||||
/// \f$\left({x_1 \cdot y_2 - y_1 \cdot x_2, x_2 \cdot y_0 - y_2 \cdot x_0, x_0 \cdot y_1 - y_0 \cdot x_1}\right)\f$
|
||||
@@ -212,11 +207,10 @@ constexpr vector<genType, i...> cross(const vector<genType, i...>& x, const vect
|
||||
|
||||
// normalize -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief Returns a vector in the same direction as \f$x\f$, but with a length of \f$1\f$, i.e.
|
||||
///
|
||||
/// \returns a vector in the same direction as \f$x\f$, but with a length of \f$1\f$, i.e.\f$\frac{x}{||x||}<br><br>
|
||||
/// \returns a vector in the same direction as \f$x\f$, but with a length of \f$1\f$, i.e.\f$\frac{x}{||x||}\f$<br><br>
|
||||
/// \details we can represent this in linear algebra as the following, <br><br>
|
||||
/// let \f$X=\left[\begin{array}\\ x_0 \\ x_1 \\ \vdots \\ x_N \end{array}\right]\f$ <br><br>
|
||||
///
|
||||
@@ -230,7 +224,6 @@ constexpr vector<genType, i...> normalize(const vector<genType, i...>& x)
|
||||
|
||||
// faceforward ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief If \f$\text{dot}(Nref, I)<0\f$ return \f$N\f$, otherwise return \f$-N\f$.
|
||||
///
|
||||
@@ -246,7 +239,6 @@ constexpr vector<genType, i...> faceforward(const vector<genType, i...>& N, cons
|
||||
|
||||
// reflect -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief For the incident vector \f$I\f$ and surface orientation \f$N\f$, returns the reflection direction.
|
||||
///
|
||||
@@ -263,8 +255,7 @@ constexpr vector<genType, i...> reflect(const vector<genType, i...>& I, const ve
|
||||
// refract -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief or the incident vector \f$I\f$ and surface normal \f$N\f$, and the ratio of indices of refraction \f$eta\f$,
|
||||
/// \brief For the incident vector \f$I\f$ and surface normal \f$N\f$, and the ratio of indices of refraction \f$eta\f$,
|
||||
/// return the refraction vector.
|
||||
///
|
||||
/// \returns The refraction vector, given the incident vector \f$I\f$, surface normal \f$N\f$, and ratio \f$eta\f$.<br><br>
|
||||
@@ -279,7 +270,8 @@ template<typename genType, size_t...i>
|
||||
constexpr vector<genType, i...> refract(const vector<genType, i...>& I, const vector<genType, i...>& N, genType eta)
|
||||
{ genType ndi = fennec::dot(N, I);
|
||||
genType k = 1.0 - eta * eta * (1.0 - ndi * ndi);
|
||||
return (k < 0.0) ? 0.0 : eta * I - N * (eta * ndi + fennec::sqrt(k)); }
|
||||
return fennec::max(0.0, eta * I - N * (eta * ndi + fennec::sqrt(k))); }
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_MATH_GEOMETRIC_H
|
||||
|
||||
Reference in New Issue
Block a user