Blender V5.0
math_geom_inline.cc File Reference
#include "BLI_math_vector.h"
#include <cstring>

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 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 10 of file math_geom_inline.cc.

◆ SMALL_NUMBER

Function Documentation

◆ 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.cc.

References area_tri_signed_v2(), MINLINE, 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.cc.

References MINLINE, and v2.

Referenced by area_squared_tri_v2(), and area_tri_v2().

◆ area_tri_v2()

◆ 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 42 of file math_geom_inline.cc.

References fabsf, and MINLINE.

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 62 of file math_geom_inline.cc.

References fabsf, and MINLINE.

◆ 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 91 of file math_geom_inline.cc.

References fabsf, MINLINE, 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])

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

Definition at line 83 of file math_geom_inline.cc.

References fabsf, MINLINE, x, y, and z().

Referenced by calc_initial_placement_point_from_view(), distribute_grid(), isect_ray_tri_watertight_v3_precalc(), and ortho_v3_v3().

◆ cross_tri_v2()

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

◆ max_axis_v3()

MINLINE int max_axis_v3 ( const float vec[3])

Definition at line 99 of file math_geom_inline.cc.

References MINLINE, x, y, and z().

◆ min_axis_v3()

MINLINE int min_axis_v3 ( const float vec[3])

Definition at line 107 of file math_geom_inline.cc.

References MINLINE, x, y, and z().

Referenced by view3d_ruler_pick().

◆ plane_point_side_v3()

◆ poly_to_tri_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 126 of file math_geom_inline.cc.

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

Referenced by blender::ed::transform::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 156 of file math_geom_inline.cc.

References add_v2_v2v2(), b, BLI_ASSERT_UNIT_V2, dot_v2v2(), fabsf, MINLINE, 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 137 of file math_geom_inline.cc.

References b, BLI_ASSERT_UNIT_V2, dot_v2v2(), fabsf, MINLINE, 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 145 of file math_geom_inline.cc.

References add_v3_v3v3(), b, BLI_ASSERT_UNIT_V3, dot_v3v3(), fabsf, MINLINE, 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] )

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

Definition at line 130 of file math_geom_inline.cc.

References b, BLI_ASSERT_UNIT_V3, dot_v3v3(), fabsf, MINLINE, SMALL_NUMBER, and UNLIKELY.

Referenced by BM_vert_calc_shell_factor(), BM_vert_calc_shell_factor_ex(), bmo_inset_region_exec(), MOD_solidify_extrude_modifyMesh(), and solidify_add_thickness().