Blender V4.3
GeomUtils.cpp File Reference

Various tools for geometry. More...

#include "GeomUtils.h"
#include "BLI_sys_types.h"

Go to the source code of this file.

Namespaces

namespace  Freestyle
 inherits from class Rep
 
namespace  Freestyle::GeomUtils
 

Macros

#define X   0
 
#define Y   1
 
#define Z   2
 
#define FINDMINMAX(x0, x1, x2, min, max)
 
#define AXISTEST_X01(a, b, fa, fb)
 
#define AXISTEST_X2(a, b, fa, fb)
 
#define AXISTEST_Y02(a, b, fa, fb)
 
#define AXISTEST_Y1(a, b, fa, fb)
 
#define AXISTEST_Z12(a, b, fa, fb)
 
#define AXISTEST_Z0(a, b, fa, fb)
 
#define PERP(u, v)   ((u)[0] * (v)[1] - (u)[1] * (v)[0])
 

Functions

bool Freestyle::GeomUtils::intersect2dSegPoly (Vec2r *seg, Vec2r *poly, uint n)
 
bool Freestyle::GeomUtils::intersect2dSeg2dArea (const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B)
 
bool Freestyle::GeomUtils::include2dSeg2dArea (const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B)
 
intersection_test Freestyle::GeomUtils::intersect2dSeg2dSeg (const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, Vec2r &res)
 
intersection_test Freestyle::GeomUtils::intersect2dLine2dLine (const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, Vec2r &res)
 
intersection_test Freestyle::GeomUtils::intersect2dSeg2dSegParametric (const Vec2r &p1, const Vec2r &p2, const Vec2r &p3, const Vec2r &p4, real &t, real &u, real epsilon)
 
bool Freestyle::GeomUtils::overlapPlaneBox (const Vec3r &normal, const real d, const Vec3r &maxbox)
 
bool Freestyle::GeomUtils::overlapTriangleBox (const Vec3r &boxcenter, const Vec3r &boxhalfsize, const Vec3r triverts[3])
 
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)
 
intersection_test Freestyle::GeomUtils::intersectRayPlane (const Vec3r &orig, const Vec3r &dir, const Vec3r &norm, const real d, real &t, const real epsilon)
 
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)
 
bool Freestyle::GeomUtils::includePointTriangle (const Vec3r &P, const Vec3r &A, const Vec3r &B, const Vec3r &C)
 
void Freestyle::GeomUtils::transformVertex (const Vec3r &vert, const Matrix44r &matrix, Vec3r &res)
 
void Freestyle::GeomUtils::transformVertices (const vector< Vec3r > &vertices, const Matrix44r &trans, vector< Vec3r > &res)
 
Vec3r Freestyle::GeomUtils::rotateVector (const Matrix44r &mat, const Vec3r &v)
 
void Freestyle::GeomUtils::fromCoordAToCoordB (const Vec3r &p, Vec3r &q, const real transform[4][4])
 
void Freestyle::GeomUtils::fromWorldToCamera (const Vec3r &p, Vec3r &q, const real model_view_matrix[4][4])
 
void Freestyle::GeomUtils::fromCameraToRetina (const Vec3r &p, Vec3r &q, const real projection_matrix[4][4])
 
void Freestyle::GeomUtils::fromRetinaToImage (const Vec3r &p, Vec3r &q, const int viewport[4])
 
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])
 
void Freestyle::GeomUtils::fromWorldToImage (const Vec3r &p, Vec3r &q, const real transform[4][4], const int viewport[4])
 
void Freestyle::GeomUtils::fromImageToRetina (const Vec3r &p, Vec3r &q, const int viewport[4])
 
void Freestyle::GeomUtils::fromRetinaToCamera (const Vec3r &p, Vec3r &q, real focal, const real projection_matrix[4][4])
 
void Freestyle::GeomUtils::fromCameraToWorld (const Vec3r &p, Vec3r &q, const real model_view_matrix[4][4])
 

Detailed Description

Various tools for geometry.

Definition in file GeomUtils.cpp.

Macro Definition Documentation

◆ AXISTEST_X01

#define AXISTEST_X01 ( a,
b,
fa,
fb )
Value:
{ \
p0 = a * v0[Y] - b * v0[Z]; \
p2 = a * v2[Y] - b * v2[Z]; \
if (p0 < p2) { \
min = p0; \
max = p2; \
} \
else { \
min = p2; \
max = p0; \
} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
#define Z
#define Y
ATTR_WARN_UNUSED_RESULT const BMVert * v2
local_group_size(16, 16) .push_constant(Type b
BLI_INLINE float fb(float length, float L)
#define min(a, b)
Definition sort.c:32

Definition at line 227 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ AXISTEST_X2

#define AXISTEST_X2 ( a,
b,
fa,
fb )
Value:
{ \
p0 = a * v0[Y] - b * v0[Z]; \
p1 = a * v1[Y] - b * v1[Z]; \
if (p0 < p1) { \
min = p0; \
max = p1; \
} \
else { \
min = p1; \
max = p0; \
} \
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0

Definition at line 246 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ AXISTEST_Y02

#define AXISTEST_Y02 ( a,
b,
fa,
fb )
Value:
{ \
p0 = -a * v0[X] + b * v0[Z]; \
p2 = -a * v2[X] + b * v2[Z]; \
if (p0 < p2) { \
min = p0; \
max = p2; \
} \
else { \
min = p2; \
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0
#define X

Definition at line 266 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ AXISTEST_Y1

#define AXISTEST_Y1 ( a,
b,
fa,
fb )
Value:
{ \
p0 = -a * v0[X] + b * v0[Z]; \
p1 = -a * v1[X] + b * v1[Z]; \
if (p0 < p1) { \
min = p0; \
max = p1; \
} \
else { \
min = p1; \
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0

Definition at line 285 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ AXISTEST_Z0

#define AXISTEST_Z0 ( a,
b,
fa,
fb )
Value:
{ \
p0 = a * v0[X] - b * v0[Y]; \
p1 = a * v1[X] - b * v1[Y]; \
if (p0 < p1) { \
min = p0; \
max = p1; \
} \
else { \
min = p1; \
max = p0; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0

Definition at line 324 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ AXISTEST_Z12

#define AXISTEST_Z12 ( a,
b,
fa,
fb )
Value:
{ \
p1 = a * v1[X] - b * v1[Y]; \
p2 = a * v2[X] - b * v2[Y]; \
if (p2 < p1) { \
min = p2; \
max = p1; \
} \
else { \
min = p1; \
max = p2; \
} \
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
if (min > rad || max < -rad) { \
return 0; \
} \
} \
(void)0

Definition at line 305 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ FINDMINMAX

#define FINDMINMAX ( x0,
x1,
x2,
min,
max )
Value:
{ \
min = max = x0; \
if (x1 < min) { \
min = x1; \
} \
if (x1 > max) { \
max = x1; \
} \
if (x2 < min) { \
min = x2; \
} \
if (x2 > max) { \
max = x2; \
} \
} \
(void)0

Definition at line 208 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::overlapTriangleBox().

◆ PERP

#define PERP ( u,
v )   ((u)[0] * (v)[1] - (u)[1] * (v)[0])

Definition at line 747 of file GeomUtils.cpp.

Referenced by Freestyle::GeomUtils::intersect2dSegPoly().

◆ X

#define X   0

Definition at line 204 of file GeomUtils.cpp.

Referenced by libmv::euclidean_resection::AbsoluteOrientation(), bsdf_ashikhmin_shirley_eval(), bsdf_ashikhmin_shirley_sample(), bsdf_hair_chiang_eval(), bsdf_hair_chiang_sample(), bsdf_hair_huang_eval(), bsdf_hair_huang_sample(), bsdf_microfacet_eval(), bsdf_microfacet_sample(), btSoftBodyHelpers::CreateFromVtkFile(), libmv::CrossProductMatrix(), libmv::Depth(), libmv::Depth(), slim::doublearea_sort3(), libmv::EliminateRow(), ensure_valid_specular_reflection(), libmv::EuclideanIntersect(), libmv::euclidean_resection::EuclideanResectionAnsarDaniilidis(), libmv::EuclideanToHomogeneous(), libmv::EuclideanToHomogeneous(), libmv::EuclideanToHomogeneous(), libmv::FundamentalFromProjections(), Freestyle::GenerateBezier(), libmv::HomogeneousToEuclidean(), libmv::HomogeneousToEuclidean(), libmv::HomogeneousToEuclidean(), libmv::EuclideanReconstruction::InsertPoint(), libmv::ProjectiveReconstruction::InsertPoint(), libmv::isInFrontOfCamera(), libmv::isInFrontOfCamera(), libmv::ModalSolver(), libmv::MotionFromEssentialChooseSolution(), newPerlin(), libmv::NRealisticCamerasSparse(), libmv::NViewTriangulate(), libmv::NViewTriangulateAlgebraic(), orthogonalize_m3_zero_axes_impl(), Freestyle::GeomUtils::overlapPlaneBox(), Freestyle::GeomUtils::overlapTriangleBox(), perlin_1d(), perlin_2d(), perlin_3d(), perlin_4d(), blender::noise::perlin_noise(), blender::noise::perlin_noise(), blender::noise::perlin_noise(), blender::noise::perlin_noise(), MD5Hash::process(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::Project(), libmv::ProjectiveIntersect(), libmv::resection::Resection(), libmv::TEST(), TEST(), KDL::Rotation::UnitX(), KDL::Rotation::UnitY(), KDL::Rotation::UnitZ(), updateDuplicateTransformConstraintSettings(), and xyY_to_xyz().

◆ Y

◆ Z