SOFUS ..
|
Single Purpose Solutions. A number of lighweight additions to C and/or C++. More...
Namespaces | |
namespace | nix |
namespace | win32 |
Classes | |
struct | bbox_t |
Bounding box. More... | |
struct | circle_t |
struct | element_circular_t |
struct | element_rect_t |
Element representation. More... | |
struct | ellipsis_t |
struct | euler_t |
Euler angles. More... | |
struct | mat3_t |
class | msignal1D |
struct | point_t |
Point type (aligned) More... | |
struct | rect_t |
Rectangle. More... | |
Typedefs | |
typedef enum sps::RotationConvention | RotationConvention |
template<typename T > | |
using | vector_t = point_t< T > |
Vector aliased as point. More... | |
Enumerations | |
enum | RotationConvention { EulerIntrinsicZYZ = 0x00 , EulerIntrinsicYXY = 0x01 } |
Functions | |
template<typename I , typename J > | |
std::pair< I, J > | minmax_weighted_element (I begin, I end, J it) |
template<typename T , typename U > | |
std::pair< T, T > | minmax_delay (const T *xs, const U *ws, size_t nData) |
template<class T > | |
T | dist_point_to_point (const point_t< T > &a, const point_t< T > &b) |
template<typename T > | |
T | dot (const point_t< T > &a, const point_t< T > &b) |
template<typename T > | |
point_t< T > | operator- (const point_t< T > &a, const point_t< T > &b) |
template<typename T > | |
point_t< T > | operator+ (const point_t< T > &a, const point_t< T > &b) |
template<typename T > | |
point_t< T > | cross (const point_t< T > &a, const point_t< T > &b) |
template<typename T > | |
point_t< T > | operator* (const T &a, const point_t< T > &b) |
template<typename T > | |
T | norm (const point_t< T > &a) |
template<typename T > | |
T | dist_point_to_line (const point_t< T > &point, const point_t< T > &pointOnLine, const point_t< T > &direction) |
template<typename T > | |
T | sgn_dist_to_plane (const point_t< T > &point, const point_t< T > &pointOnPlane, const point_t< T > &unitNormal) |
template<typename T > | |
T | dist_point_to_circle (const point_t< T > &point, const circle_t< T > &circle) |
template<typename T > | |
void | dist_point_to_circle_local (const point_t< T > &point, const circle_t< T > &circle, T *r, T *z, T *distNear) |
template<typename T > | |
void | dist_point_to_circle_local (const point_t< T > &point, const circle_t< T > &circle, T *r, T *z, T *distNear, T *distFar) |
template<typename T > | |
sps::point_t< T > | clamp_vector (const sps::point_t< T > &point, const sps::bbox_t< T > &box) |
template<typename T > | |
void | compute_bounding_box3 (const T *pos, const size_t nPos, sps::bbox_t< T > *box) |
template<typename T > | |
bool | point_inside_box (const sps::point_t< T > &point, const sps::bbox_t< T > &box) |
template<typename T > | |
sps::point_t< T > | nearest_point_on_bbox (const sps::point_t< T > &point, const sps::bbox_t< T > &box) |
template<typename T > | |
sps::point_t< T > | farthest_point_on_bbox (const sps::point_t< T > &point, const sps::bbox_t< T > &box) |
template<typename T > | |
void | dists_most_distant_and_closest (const sps::bbox_t< T > &box0, const sps::bbox_t< T > &box1, T *distNear, T *distFar) |
template<typename T , RotationConvention conv> | |
void | basis_vectors (sps::point_t< T > *output, const sps::euler_t< T > &euler, size_t index) |
template<typename T , RotationConvention conv> | |
void | euler2rot (const sps::euler_t< T > &euler, sps::mat3_t< T > *mat) |
template<typename T , RotationConvention conv> | |
void | rot2euler (const sps::mat3_t< T > &rot, euler_t< T > *euler) |
template<typename T , RotationConvention conv> | |
void | basis_rotate (const sps::point_t< T > &input, const euler_t< T > &euler, sps::point_t< T > *output) |
template<typename T > | |
void | basis_vectors (T *vec0, T *vec1, T *vec2, const sps::euler_t< T > &euler) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const point_t< T > &point) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const mat3_t< T > &mat) |
template<typename T > | |
void | compute_bounding_box_circle (const sps::circle_t< T > &circle, sps::bbox_t< T > *box) |
template<typename T > | |
void | arc_point_ellipsis (const sps::ellipsis_t< T > &ellipsis, const T &arc, sps::point_t< T > *point) |
template<typename T > | |
void | tan_point_ellipsis (const sps::ellipsis_t< T > &ellipsis, const T &y, const T &x, sps::point_t< T > *point) |
template<typename T > | |
void | intcp_line_rect (const sps::element_rect_t< T > &rect, const T &y, const T &x, sps::point_t< T > *point) |
Single Purpose Solutions. A number of lighweight additions to C and/or C++.
typedef enum sps::RotationConvention RotationConvention |
enum RotationConvention |
void arc_point_ellipsis | ( | const sps::ellipsis_t< T > & | ellipsis, |
const T & | arc, | ||
sps::point_t< T > * | point | ||
) |
Intersection point of line originating from center of ellipsis in the plane defined using Euler coordinates and a direction angle arc
TODO(JMH): Support Euler orientation, ellipsis is assumed to lie in xy-plane
[in] | ellipsis | |
[in] | arc | angle |
[out] | point | intersection point |
void basis_rotate | ( | const sps::point_t< T > & | input, |
const euler_t< T > & | euler, | ||
sps::point_t< T > * | output | ||
) |
Rotate point using 3 Euler angles according to the convention.
conv | Rotation convention |
input | |
euler | |
output |
void basis_vectors | ( | sps::point_t< T > * | output, |
const sps::euler_t< T > & | euler, | ||
size_t | index | ||
) |
Function for returning the basis vector for a given coordinate system defined using 3 Euler angles according to the the z-x-z' or y-x-y' convention.
conv | Rotation convention |
output | |
euler | |
index |
void basis_vectors | ( | T * | vec0, |
T * | vec1, | ||
T * | vec2, | ||
const sps::euler_t< T > & | euler | ||
) |
Function for returning the basis vector for a given coordinate system defined using 3 Euler angles according to the the z-x-z' convention. Using SIMD for packed singles
vec0 | |
vec1 | |
vec2 | |
euler |
|
inline |
Clamp a vector inside a box
point | |
box |
References bbox_t< T >::max, and bbox_t< T >::min.
Referenced by nearest_point_on_bbox().
void compute_bounding_box3 | ( | const T * | pos, |
const size_t | nPos, | ||
sps::bbox_t< T > * | box | ||
) |
Compute bounding box aligned with the axes for 3D positions
pos | |
nPos | |
box |
References bbox_t< T >::max, and bbox_t< T >::min.
void compute_bounding_box_circle | ( | const sps::circle_t< T > & | circle, |
sps::bbox_t< T > * | box | ||
) |
References circle_t< T >::center, dot(), circle_t< T >::euler, bbox_t< T >::max, bbox_t< T >::min, and circle_t< T >::radius.
Cross product of two points or vectors
a | |
b |
Referenced by dist_point_to_line().
Distance from point to circle
point | |
circle |
void dist_point_to_circle_local | ( | const point_t< T > & | point, |
const circle_t< T > & | circle, | ||
T * | r, | ||
T * | z, | ||
T * | distNear | ||
) |
void dist_point_to_circle_local | ( | const point_t< T > & | point, |
const circle_t< T > & | circle, | ||
T * | r, | ||
T * | z, | ||
T * | distNear, | ||
T * | distFar | ||
) |
Distance from point to point
a | First point |
b | Second point |
|
inline |
Shortest and longest distance between any point on two boxes
box0 | |
box1 | |
distNear | Shortest distance |
distFar | Longest distance |
TODO: Verify if point is inside a box
References bbox_t< T >::max, bbox_t< T >::min, and nearest_point_on_bbox().
Dot product of vectors or points
a | |
b |
Referenced by sofus::calcProjectionAndBoundaries(), compute_bounding_box_circle(), norm(), and sgn_dist_to_plane().
void euler2rot | ( | const sps::euler_t< T > & | euler, |
sps::mat3_t< T > * | mat | ||
) |
|
inline |
Farthest point on a box (from a point)
point | |
box |
References bbox_t< T >::max, and bbox_t< T >::min.
void intcp_line_rect | ( | const sps::element_rect_t< T > & | rect, |
const T & | y, | ||
const T & | x, | ||
sps::point_t< T > * | point | ||
) |
std::pair< T, T > minmax_delay | ( | const T * | xs, |
const U * | ws, | ||
size_t | nData | ||
) |
std::pair< I, J > minmax_weighted_element | ( | I | begin, |
I | end, | ||
J | it | ||
) |
|
inline |
Nearest point on a box (from a point)
point | |
box |
References clamp_vector().
Referenced by dists_most_distant_and_closest().
|
inline |
Norm of a vector or point
a |
References dot().
Referenced by sofus::calcProjectionAndBoundaries(), and dist_point_to_line().
Scalar multiplication of a vector or point
a | scalar |
b | point |
Add two points
a | |
b |
Subtract two points
a | |
b |
|
inline |
References mat3_t< T >::data.
|
inline |
Operator for printing points to a stream
out | |
point |
|
inline |
References bbox_t< T >::max, and bbox_t< T >::min.
void rot2euler | ( | const sps::mat3_t< T > & | rot, |
euler_t< T > * | euler | ||
) |
|
inline |
Signed distance from point to plane.
point | ![]() |
pointOnPlane | ![]() |
unitNormal | ![]() |
References dot().
void tan_point_ellipsis | ( | const sps::ellipsis_t< T > & | ellipsis, |
const T & | y, | ||
const T & | x, | ||
sps::point_t< T > * | point | ||
) |