Blender  V3.3
Macros | Functions
math_geom_inline.c File Reference
#include "BLI_math.h"
#include "BLI_math_vector.h"
#include <string.h>

Go to the source code of this file.

Macros

#define __MATH_GEOM_INLINE_C__
 
#define SMALL_NUMBER   1.e-8f
 

Functions

MINLINE float cross_tri_v2 (const float v1[2], const float v2[2], const float v3[2])
 
MINLINE float area_tri_signed_v2 (const float v1[2], const float v2[2], const float v3[2])
 
MINLINE float area_tri_v2 (const float v1[2], const float v2[2], const float v3[2])
 
MINLINE float area_squared_tri_v2 (const float v1[2], const float v2[2], const float v3[2])
 
MINLINE void zero_sh (float r[9])
 
MINLINE void copy_sh_sh (float r[9], const float a[9])
 
MINLINE void mul_sh_fl (float r[9], const float f)
 
MINLINE void add_sh_shsh (float r[9], const float a[9], const float b[9])
 
MINLINE float dot_shsh (const float a[9], const float b[9])
 
MINLINE float diffuse_shv3 (const float sh[9], const float v[3])
 
MINLINE void vec_fac_to_sh (float r[9], const float v[3], const float f)
 
MINLINE float eval_shv3 (float sh[9], const float v[3])
 
MINLINE void madd_sh_shfl (float r[9], const float sh[9], const float f)
 
MINLINE void axis_dominant_v3 (int *r_axis_a, int *r_axis_b, const float axis[3])
 
MINLINE float axis_dominant_v3_max (int *r_axis_a, int *r_axis_b, const float axis[3])
 
MINLINE int axis_dominant_v3_single (const float vec[3])
 
MINLINE int axis_dominant_v3_ortho_single (const float vec[3])
 
MINLINE int max_axis_v3 (const float vec[3])
 
MINLINE int min_axis_v3 (const float vec[3])
 
MINLINE int poly_to_tri_count (const int poly_count, const int corner_count)
 
MINLINE float plane_point_side_v3 (const float plane[4], const float co[3])
 
MINLINE float shell_angle_to_dist (const float angle)
 
MINLINE float shell_v3v3_normalized_to_dist (const float a[3], const float b[3])
 
MINLINE float shell_v2v2_normalized_to_dist (const float a[2], const float b[2])
 
MINLINE float shell_v3v3_mid_normalized_to_dist (const float a[3], const float b[3])
 
MINLINE float shell_v2v2_mid_normalized_to_dist (const float a[2], const float b[2])
 

Macro Definition Documentation

◆ __MATH_GEOM_INLINE_C__

#define __MATH_GEOM_INLINE_C__

Definition at line 9 of file math_geom_inline.c.

◆ SMALL_NUMBER

#define SMALL_NUMBER   1.e-8f

Definition at line 17 of file math_geom_inline.c.

Function Documentation

◆ add_sh_shsh()

MINLINE void add_sh_shsh ( float  r[9],
const float  a[9],
const float  b[9] 
)

Definition at line 63 of file math_geom_inline.c.

References Freestyle::a, usdtokens::b(), and r.

Referenced by madd_sh_shfl().

◆ area_squared_tri_v2()

MINLINE float area_squared_tri_v2 ( const float  v1[2],
const float  v2[2],
const float  v3[2] 
)

Definition at line 36 of file math_geom_inline.c.

References blender::compositor::area(), area_tri_signed_v2(), v1, and v2.

◆ area_tri_signed_v2()

MINLINE float area_tri_signed_v2 ( const float  v1[2],
const float  v2[2],
const float  v3[2] 
)

Definition at line 26 of file math_geom_inline.c.

References v1, and v2.

Referenced by area_squared_tri_v2(), and area_tri_v2().

◆ area_tri_v2()

MINLINE float area_tri_v2 ( const float  v1[2],
const float  v2[2],
const float  v3[2] 
)

◆ axis_dominant_v3()

MINLINE void axis_dominant_v3 ( int *  r_axis_a,
int *  r_axis_b,
const float  axis[3] 
)

Get the 2 dominant axis values, 0==X, 1==Y, 2==Z.

Definition at line 149 of file math_geom_inline.c.

References fabsf.

Referenced by barycentric_differentials_from_position(), barycentric_weights(), and uvedit_unwrap_cube_project().

◆ axis_dominant_v3_max()

MINLINE float axis_dominant_v3_max ( int *  r_axis_a,
int *  r_axis_b,
const float  axis[3] 
)

Same as axis_dominant_v3 but return the max value.

Definition at line 169 of file math_geom_inline.c.

References fabsf.

◆ axis_dominant_v3_ortho_single()

MINLINE int axis_dominant_v3_ortho_single ( const float  vec[3])

The dominant axis of an orthogonal vector.

Definition at line 200 of file math_geom_inline.c.

References fabsf, x, y, and z.

Referenced by ED_view3d_cursor3d_position_rotation().

◆ axis_dominant_v3_single()

MINLINE int axis_dominant_v3_single ( const float  vec[3])

◆ copy_sh_sh()

MINLINE void copy_sh_sh ( float  r[9],
const float  a[9] 
)

Definition at line 49 of file math_geom_inline.c.

References Freestyle::a, and r.

Referenced by madd_sh_shfl(), and vec_fac_to_sh().

◆ cross_tri_v2()

MINLINE float cross_tri_v2 ( const float  v1[2],
const float  v2[2],
const float  v3[2] 
)

◆ diffuse_shv3()

MINLINE float diffuse_shv3 ( const float  sh[9],
const float  v[3] 
)

Definition at line 84 of file math_geom_inline.c.

References sh, sum(), v, x, y, and z.

◆ dot_shsh()

MINLINE float dot_shsh ( const float  a[9],
const float  b[9] 
)

Definition at line 72 of file math_geom_inline.c.

References Freestyle::a, usdtokens::b(), and r.

Referenced by eval_shv3().

◆ eval_shv3()

MINLINE float eval_shv3 ( float  sh[9],
const float  v[3] 
)

Definition at line 132 of file math_geom_inline.c.

References dot_shsh(), sh, v, and vec_fac_to_sh().

◆ madd_sh_shfl()

MINLINE void madd_sh_shfl ( float  r[9],
const float  sh[9],
const float  f 
)

Definition at line 140 of file math_geom_inline.c.

References add_sh_shsh(), copy_sh_sh(), mul_sh_fl(), r, and sh.

◆ max_axis_v3()

MINLINE int max_axis_v3 ( const float  vec[3])

◆ min_axis_v3()

MINLINE int min_axis_v3 ( const float  vec[3])

Definition at line 216 of file math_geom_inline.c.

References x, y, and z.

Referenced by view3d_ruler_pick().

◆ mul_sh_fl()

MINLINE void mul_sh_fl ( float  r[9],
const float  f 
)

Definition at line 54 of file math_geom_inline.c.

References r.

Referenced by madd_sh_shfl(), and vec_fac_to_sh().

◆ plane_point_side_v3()

MINLINE float plane_point_side_v3 ( const float  plane[4],
const float  co[3] 
)

◆ poly_to_tri_count()

MINLINE int poly_to_tri_count ( int  poly_count,
int  corner_count 
)

◆ shell_angle_to_dist()

MINLINE float shell_angle_to_dist ( float  angle)

Useful to calculate an even width shell, by taking the angle between 2 planes. The return value is a scale on the offset. no angle between planes is 1.0, as the angle between the 2 planes approaches 180d the distance gets very high, 180d would be inf, but this case isn't valid.

Definition at line 235 of file math_geom_inline.c.

References angle(), cosf, fabsf, SMALL_NUMBER, and UNLIKELY.

Referenced by Bend(), and BM_mesh_wireframe().

◆ shell_v2v2_mid_normalized_to_dist()

MINLINE float shell_v2v2_mid_normalized_to_dist ( const float  a[2],
const float  b[2] 
)

Equivalent to shell_angle_to_dist(angle_normalized_v2v2(a, b) / 2).

Definition at line 265 of file math_geom_inline.c.

References Freestyle::a, add_v2_v2v2(), usdtokens::b(), BLI_ASSERT_UNIT_V2, dot_v2v2(), fabsf, normalize_v2(), SMALL_NUMBER, and UNLIKELY.

◆ shell_v2v2_normalized_to_dist()

MINLINE float shell_v2v2_normalized_to_dist ( const float  a[2],
const float  b[2] 
)

Equivalent to shell_angle_to_dist(angle_normalized_v2v2(a, b)).

Definition at line 246 of file math_geom_inline.c.

References Freestyle::a, usdtokens::b(), BLI_ASSERT_UNIT_V2, dot_v2v2(), fabsf, SMALL_NUMBER, and UNLIKELY.

◆ shell_v3v3_mid_normalized_to_dist()

MINLINE float shell_v3v3_mid_normalized_to_dist ( const float  a[3],
const float  b[3] 
)

Equivalent to shell_angle_to_dist(angle_normalized_v3v3(a, b) / 2).

Definition at line 254 of file math_geom_inline.c.

References Freestyle::a, add_v3_v3v3(), usdtokens::b(), BLI_ASSERT_UNIT_V3, dot_v3v3(), fabsf, normalize_v3(), SMALL_NUMBER, and UNLIKELY.

Referenced by alter_co(), bmo_face_inset_individual(), and bmo_inset_region_exec().

◆ shell_v3v3_normalized_to_dist()

MINLINE float shell_v3v3_normalized_to_dist ( const float  a[3],
const float  b[3] 
)

◆ vec_fac_to_sh()

MINLINE void vec_fac_to_sh ( float  r[9],
const float  v[3],
const float  f 
)

Definition at line 106 of file math_geom_inline.c.

References copy_sh_sh(), mul_sh_fl(), r, sh, v, x, y, and z.

Referenced by eval_shv3().

◆ zero_sh()

MINLINE void zero_sh ( float  r[9])

Definition at line 44 of file math_geom_inline.c.

References r.