Blender V4.3
math_geom_inline.c File Reference
#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 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.c.

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

References area_tri_signed_v2(), 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 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.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 62 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 93 of file math_geom_inline.c.

References fabsf, 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 85 of file math_geom_inline.c.

References fabsf, and z().

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

◆ cross_tri_v2()

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

Scalar cross product of a 2D triangle.

  • Equivalent to area * 2.
  • Useful for checking polygon winding (a negative value is clockwise).

Definition at line 21 of file math_geom_inline.c.

References v2.

Referenced by barycentric_weights_v2(), barycentric_weights_v2_clamped(), barycentric_weights_v2_persp(), BLI_polyfill_beautify_quad_rotate_calc_ex(), bm_edge_calc_rotate_beauty__area(), bm_loop_collapse_is_degenerate(), color_sample_remove_cost(), project_face_winding_init(), TEST(), TEST(), and test_polyfill_winding().

◆ max_axis_v3()

◆ min_axis_v3()

MINLINE int min_axis_v3 ( const float vec[3])

Definition at line 109 of file math_geom_inline.c.

References 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 128 of file math_geom_inline.c.

References 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 158 of file math_geom_inline.c.

References add_v2_v2v2(), 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 139 of file math_geom_inline.c.

References 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 147 of file math_geom_inline.c.

References add_v3_v3v3(), 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] )

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

Definition at line 132 of file math_geom_inline.c.

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