Blender
V3.3
|
Enumerations | |
enum | intersection_test { DONT_INTERSECT , DO_INTERSECT , COLINEAR , COINCIDENT } |
Functions | |
bool | intersect2dSegPoly (Vec2r *seg, Vec2r *poly, unsigned n) |
bool | intersect2dSeg2dArea (const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B) |
bool | include2dSeg2dArea (const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B) |
intersection_test | intersect2dSeg2dSeg (const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, Vec2r &res) |
intersection_test | intersect2dLine2dLine (const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, Vec2r &res) |
intersection_test | intersect2dSeg2dSegParametric (const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, real &t, real &u, real epsilon) |
bool | overlapPlaneBox (Vec3r &normal, real d, Vec3r &maxbox) |
bool | overlapTriangleBox (Vec3r &boxcenter, Vec3r &boxhalfsize, Vec3r triverts[3]) |
bool | intersectRayTriangle (const Vec3r &orig, const Vec3r &dir, const Vec3r &v0, const Vec3r &v1, const Vec3r &v2, real &t, real &u, real &v, const real epsilon) |
intersection_test | intersectRayPlane (const Vec3r &orig, const Vec3r &dir, const Vec3r &norm, const real d, real &t, const real epsilon) |
bool | intersectRayBBox (const Vec3r &orig, const Vec3r &dir, const Vec3r &boxMin, const Vec3r &boxMax, real t0, real t1, real &tmin, real &tmax, real) |
bool | includePointTriangle (const Vec3r &P, const Vec3r &A, const Vec3r &B, const Vec3r &C) |
void | transformVertex (const Vec3r &vert, const Matrix44r &matrix, Vec3r &res) |
void | transformVertices (const vector< Vec3r > &vertices, const Matrix44r &trans, vector< Vec3r > &res) |
Vec3r | rotateVector (const Matrix44r &mat, const Vec3r &v) |
void | fromCoordAToCoordB (const Vec3r &p, Vec3r &q, const real transform[4][4]) |
void | fromWorldToCamera (const Vec3r &p, Vec3r &q, const real model_view_matrix[4][4]) |
void | fromCameraToRetina (const Vec3r &p, Vec3r &q, const real projection_matrix[4][4]) |
void | fromRetinaToImage (const Vec3r &p, Vec3r &q, const int viewport[4]) |
void | fromWorldToImage (const Vec3r &p, Vec3r &q, const real model_view_matrix[4][4], const real projection_matrix[4][4], const int viewport[4]) |
void | fromWorldToImage (const Vec3r &p, Vec3r &q, const real transform[4][4], const int viewport[4]) |
void | fromImageToRetina (const Vec3r &p, Vec3r &q, const int viewport[4]) |
void | fromRetinaToCamera (const Vec3r &p, Vec3r &q, real focal, const real projection_matrix[4][4]) |
void | fromCameraToWorld (const Vec3r &p, Vec3r &q, const real model_view_matrix[4][4]) |
template<class T > | |
real | distPointSegment (const T &P, const T &A, const T &B) |
Enumerator | |
---|---|
DONT_INTERSECT | |
DO_INTERSECT | |
COLINEAR | |
COINCIDENT |
Definition at line 59 of file GeomUtils.h.
real Freestyle::GeomUtils::distPointSegment | ( | const T & | P, |
const T & | A, | ||
const T & | B | ||
) |
Computes the distance from a point P to a segment AB
Definition at line 30 of file GeomUtils.h.
References A, B, usdtokens::b(), P(), and T.
Referenced by Freestyle::GridHelpers::distancePointToPolygon(), and Freestyle::StrokeShaders::CurvePiece::error().
void Freestyle::GeomUtils::fromCameraToRetina | ( | const Vec3r & | p, |
Vec3r & | q, | ||
const real | projection_matrix[4][4] | ||
) |
Projects from World Coordinates to retina coordinates Returns the point's coordinates expressed in Retina system. p point's coordinates expressed in camera system q vector in which the result will be stored projection_matrix The projection matrix expressed in line major order (OpenGL matrices are column major ordered)
Definition at line 652 of file GeomUtils.cpp.
References fromCoordAToCoordB().
Referenced by Freestyle::SilhouetteGeomEngine::CameraToImage(), fromWorldToImage(), and Freestyle::SilhouetteGeomEngine::ImageToWorldParameter().
void Freestyle::GeomUtils::fromCameraToWorld | ( | const Vec3r & | p, |
Vec3r & | q, | ||
const real | model_view_matrix[4][4] | ||
) |
Projects from camera coordinates to world coordinates Returns the point's coordinates expressed in the world's coordinates system. p point's coordinates expressed in the camera coordinates system q vector in which the result will be stored model_view_matrix The model view matrix expressed in line major order (OpenGL matrices are column major ordered)
Definition at line 714 of file GeomUtils.cpp.
|
inline |
Definition at line 812 of file GeomUtils.cpp.
References transform().
Referenced by fromCameraToRetina(), fromWorldToCamera(), and fromWorldToImage().
From image to retina p point's coordinates expressed in image system q vector in which the result will be stored viewport The viewport: x,y coordinates followed by width and height (OpenGL like viewport).
Definition at line 693 of file GeomUtils.cpp.
Referenced by Freestyle::SilhouetteGeomEngine::ImageToWorldParameter().
void Freestyle::GeomUtils::fromRetinaToCamera | ( | const Vec3r & | p, |
Vec3r & | q, | ||
real | focal, | ||
const real | projection_matrix[4][4] | ||
) |
computes the coordinates of q in the camera coordinates system, using the known z coordinates of the 3D point. That means that this method does not inverse any matrices, it only computes X and Y from x,y and Z) p point's coordinates expressed in retina system q vector in which the result will be stored projection_matrix The projection matrix expressed in line major order (OpenGL matrices are column major ordered)
Definition at line 700 of file GeomUtils.cpp.
From retina to image. Returns the coordinates expressed in Image coordinates system. p point's coordinates expressed in retina system q vector in which the result will be stored viewport The viewport: x,y coordinates followed by width and height (OpenGL like viewport).
Definition at line 657 of file GeomUtils.cpp.
Referenced by Freestyle::SilhouetteGeomEngine::CameraToImage(), fromWorldToImage(), and Freestyle::SilhouetteGeomEngine::ImageToWorldParameter().
void Freestyle::GeomUtils::fromWorldToCamera | ( | const Vec3r & | p, |
Vec3r & | q, | ||
const real | model_view_matrix[4][4] | ||
) |
Projects from world coordinates to camera coordinates Returns the point's coordinates expressed in the camera's coordinates system. p point's coordinates expressed in world coordinates system q vector in which the result will be stored model_view_matrix The model view matrix expressed in line major order (OpenGL matrices are column major ordered)
Definition at line 647 of file GeomUtils.cpp.
References fromCoordAToCoordB().
Referenced by fromWorldToImage(), and Freestyle::SilhouetteGeomEngine::ImageToWorldParameter().
void Freestyle::GeomUtils::fromWorldToImage | ( | const Vec3r & | p, |
Vec3r & | q, | ||
const real | model_view_matrix[4][4], | ||
const real | projection_matrix[4][4], | ||
const int | viewport[4] | ||
) |
From world to image p point's coordinates expressed in world coordinates system q vector in which the result will be stored model_view_matrix The model view matrix expressed in line major order (OpenGL matrices are column major ordered) projection_matrix The projection matrix expressed in line major order (OpenGL matrices are column major ordered) viewport The viewport: x,y coordinates followed by width and height (OpenGL like viewport)
Definition at line 669 of file GeomUtils.cpp.
References fromCameraToRetina(), fromRetinaToImage(), and fromWorldToCamera().
Referenced by Freestyle::SilhouetteGeomEngine::ProjectSilhouette(), and Freestyle::SilhouetteGeomEngine::WorldToImage().
void Freestyle::GeomUtils::fromWorldToImage | ( | const Vec3r & | p, |
Vec3r & | q, | ||
const real | transform[4][4], | ||
const int | viewport[4] | ||
) |
From world to image p point's coordinates expressed in world coordinates system q vector in which the result will be stored transform The transformation matrix (gathering model view and projection), expressed in line major order (OpenGL matrices are column major ordered) viewport The viewport: x,y coordinates followed by width and height (OpenGL like viewport)
Definition at line 682 of file GeomUtils.cpp.
References fromCoordAToCoordB(), and transform().
bool Freestyle::GeomUtils::include2dSeg2dArea | ( | const Vec2r & | min, |
const Vec2r & | max, | ||
const Vec2r & | A, | ||
const Vec2r & | B | ||
) |
check whether a 2D segment is included in a 2D region or not
Definition at line 36 of file GeomUtils.cpp.
References A, B, max, and min.
Referenced by Freestyle::ViewEdge::include_in_2d_area().
intersection_test Freestyle::GeomUtils::intersect2dLine2dLine | ( | const Vec2r & | p1, |
const Vec2r & | p2, | ||
const Vec2r & | p3, | ||
const Vec2r & | p4, | ||
Vec2r & | res | ||
) |
Definition at line 97 of file GeomUtils.cpp.
References COLINEAR, DO_INTERSECT, fabs(), and Freestyle::M_EPSILON.
Referenced by Freestyle::Strip::createStrip().
bool Freestyle::GeomUtils::intersect2dSeg2dArea | ( | const Vec2r & | min, |
const Vec2r & | max, | ||
const Vec2r & | A, | ||
const Vec2r & | B | ||
) |
check whether a 2D segment intersect a 2D region or not
Definition at line 15 of file GeomUtils.cpp.
References A, B, intersect2dSegPoly(), max, and min.
Referenced by Freestyle::crossesProscenium(), Freestyle::ViewEdge::intersect_2d_area(), and Freestyle::Predicates1D::WithinImageBoundaryUP1D::operator()().
intersection_test Freestyle::GeomUtils::intersect2dSeg2dSeg | ( | const Vec2r & | p1, |
const Vec2r & | p2, | ||
const Vec2r & | p3, | ||
const Vec2r & | p4, | ||
Vec2r & | res | ||
) |
Definition at line 45 of file GeomUtils.cpp.
References COLINEAR, DO_INTERSECT, DONT_INTERSECT, fabs(), and Freestyle::M_EPSILON.
intersection_test Freestyle::GeomUtils::intersect2dSeg2dSegParametric | ( | const Vec2r & | p1, |
const Vec2r & | p2, | ||
const Vec2r & | p3, | ||
const Vec2r & | p4, | ||
real & | t, | ||
real & | u, | ||
real | epsilon | ||
) |
Definition at line 128 of file GeomUtils.cpp.
References COLINEAR, DO_INTERSECT, DONT_INTERSECT, blender::robust_pred::epsilon, fabs(), and t.
Referenced by Freestyle::SweepLine< T, Point >::add().
Definition at line 742 of file GeomUtils.cpp.
References D, e, fabs(), Freestyle::M_EPSILON, N, PERP, and t.
Referenced by intersect2dSeg2dArea().
bool Freestyle::GeomUtils::intersectRayBBox | ( | const Vec3r & | orig, |
const Vec3r & | dir, | ||
const Vec3r & | boxMin, | ||
const Vec3r & | boxMax, | ||
real | t0, | ||
real | t1, | ||
real & | tmin, | ||
real & | tmax, | ||
real | epsilon = M_EPSILON |
||
) |
Intersection Ray-Bounding box (axis aligned). Adapted from Williams et al, "An Efficient Robust Ray-Box Intersection Algorithm", JGT 10:1 (2005), pp. 49-54.
Definition at line 524 of file GeomUtils.cpp.
References bounds(), KDL::sign(), Freestyle::VecMat::Vec3< T >::x(), Freestyle::VecMat::Vec3< T >::y(), and Freestyle::VecMat::Vec3< T >::z().
Referenced by Freestyle::Grid::initInfiniteRay().
intersection_test Freestyle::GeomUtils::intersectRayPlane | ( | const Vec3r & | orig, |
const Vec3r & | dir, | ||
const Vec3r & | norm, | ||
const real | d, | ||
real & | t, | ||
const real | epsilon = M_EPSILON |
||
) |
Intersection between plane and ray adapted from Graphics Gems, Didier Badouel
Definition at line 498 of file GeomUtils.cpp.
References COINCIDENT, COLINEAR, DO_INTERSECT, DONT_INTERSECT, blender::robust_pred::epsilon, fabs(), norm(), and t.
Referenced by Freestyle::ViewMapBuilder::ComputeRayCastingVisibility(), Freestyle::computeVisibility(), Freestyle::findOccludee(), Freestyle::ViewMapBuilder::FindOccludee(), and Freestyle::FEdgeXDetector::postProcessSuggestiveContourFace().
bool Freestyle::GeomUtils::intersectRayTriangle | ( | const Vec3r & | orig, |
const Vec3r & | dir, | ||
const Vec3r & | v0, | ||
const Vec3r & | v1, | ||
const Vec3r & | v2, | ||
real & | t, | ||
real & | u, | ||
real & | v, | ||
const real | epsilon = M_EPSILON |
||
) |
Fast, Minimum Storage Ray-Triangle Intersection, adapted from Tomas Möller and Ben Trumbore code.
Definition at line 430 of file GeomUtils.cpp.
References blender::robust_pred::epsilon, t, v, v1, and v2.
Referenced by Freestyle::Geometry::Polygon3r::rayIntersect().
Definition at line 789 of file GeomUtils.cpp.
Referenced by overlapTriangleBox().
bool Freestyle::GeomUtils::overlapTriangleBox | ( | Vec3r & | boxcenter, |
Vec3r & | boxhalfsize, | ||
Vec3r | triverts[3] | ||
) |
Box-triangle overlap test, adapted from Tomas Akenine-Möller code
Definition at line 345 of file GeomUtils.cpp.
References AXISTEST_X01, AXISTEST_X2, AXISTEST_Y02, AXISTEST_Y1, AXISTEST_Z0, AXISTEST_Z12, fabs(), FINDMINMAX, max, min, normal, overlapPlaneBox(), v1, v2, X, Y, and Z.
Referenced by Freestyle::Grid::insertOccluder(), and Freestyle::GridHelpers::insideProscenium().
Definition at line 631 of file GeomUtils.cpp.
References Freestyle::VecMat::Vec< T, N >::normalize(), and v.
void Freestyle::GeomUtils::transformVertex | ( | const Vec3r & | vert, |
const Matrix44r & | matrix, | ||
Vec3r & | res | ||
) |
Definition at line 606 of file GeomUtils.cpp.
References Freestyle::VecMat::HVec3< T >::x(), Freestyle::VecMat::HVec3< T >::y(), and Freestyle::VecMat::HVec3< T >::z().
Referenced by transformVertices().
void Freestyle::GeomUtils::transformVertices | ( | const vector< Vec3r > & | vertices, |
const Matrix44r & | trans, | ||
vector< Vec3r > & | res | ||
) |
Definition at line 622 of file GeomUtils.cpp.
References transformVertex().
Referenced by Freestyle::WingedEdgeBuilder::buildWShape().