Blender V5.3
blender::geometry::construct Namespace Reference

Classes

struct  NewCornerInterpData
struct  NewCornerInterpWeights

Enumerations

enum  AngleKind { ANGLE_SMALLER , ANGLE_STRAIGHT , ANGLE_LARGER }

Functions

static void adjust_miter_coords (const BevelState &state, BevVert *bv, EdgeHalf *emiter)
static void adjust_miter_inner_coords (const BevelState &state, BevVert *bv, EdgeHalf *emiter)
static bool edges_face_connected_at_vert (const ExtendableMesh &emesh, const int e1, const int e2)
static int bev_ccw_test (const ExtendableMesh &emesh, const int a, const int b, const int f)
static bool fast_bevel_edge_order (const ExtendableMesh &emesh, BevVert *bv, bool is_edge_bevel)
static int bevel_edge_order_extend (const ExtendableMesh &emesh, BevVert *bv, int i, bool is_edge_bevel)
static BoundVert * add_new_bound_vert (BevVert *bv, const float3 &co)
static void adjust_bound_vert (BoundVert *bndv, const float3 &co)
static void check_edge_data_seam_sharp_edges (const BevelState &state, BevVert *bv, bool check_seam, bool check_sharp)
static void set_bound_vert_seams (const BevelState &state, BevVert *bv, bool mark_seam, bool mark_sharp)
static float3 offset_in_plane (const ExtendableMesh &emesh, EdgeHalf *e, const float3 *plane_no, bool left)
static void build_boundary_vertex_only (const BevelState &state, BevVert *bv, bool construct)
static void build_boundary_terminal_edge (const BevelState &state, BevVert *bv, EdgeHalf *efirst, const bool construct)
static EdgeHalf * next_bev (BevVert *bv, EdgeHalf *from_e)
static bool nearly_parallel_normalized (const float3 &d1, const float3 &d2)
static AngleKind edges_angle_kind (const ExtendableMesh &emesh, EdgeHalf *e1, EdgeHalf *e2, int v)
static bool edge_has_miter (const BevelState &state, const EdgeHalf *e, int v)
static void build_boundary (const BevelState &state, BevVert *bv, bool construct)
static void find_bevel_edge_order (const ExtendableMesh &emesh, BevVert *bv, int first_e, bool is_edge_bevel)
static void determine_uv_vert_connectivity (BevelState &state, const int v)
static void bevel_vert_construct (BevelState &state, int v)
Profile orientation helpers

These functions find the chain or cycle of beveled edges connected to a given edge, and set consistent profile orientations along the chain.

static EdgeHalf * find_edge_half_for_edge (BevVert *bv, int edge_index)
static EdgeHalf * find_other_end_edge_half (const BevelState &state, EdgeHalf *e, BevVert **r_bvother)
static EdgeHalf * next_edgehalf_bev (const BevelState &state, EdgeHalf *start_edge, bool toward_bv, BevVert **r_bv)
static void regularize_profile_orientation (const BevelState &state, int edge_index)
ADJ vmesh subdivision helpers
static VMesh adj_vmesh (BevelState &state, BevVert *bv)
static VMesh new_adj_vmesh (int count, int seg, BoundVert *bounds)
static void fill_vmesh_fracs (VMesh *vm, MutableSpan< float > frac, int i)
static void fill_profile_fracs (const BevelState &state, const BoundVert *bndv, MutableSpan< float > frac, const int ns)
static int interp_range (const Span< float > frac, const int n, const float f, float *r_rest)
static VMesh interp_vmesh (const BevelState &state, VMesh &vm_in, int nseg)
static VMesh cubic_subdiv (const BevelState &state, VMesh &vm_in)
static void snap_to_superellipsoid (float3 &co, const float super_r, const bool midline)
static float4x4 make_unit_cube_map (const float3 &va, const float3 &vb, const float3 &vc, const float3 &vd)
static VMesh make_cube_corner_square (const int nseg)
static VMesh make_cube_corner_square_in (const int nseg)
static VMesh make_cube_corner_adj_vmesh (BevelState &state)
static float3 closer_v3_v3v3v3 (const float3 &a, const float3 &b, const float3 &v)
static float3 snap_to_pipe_profile (const BevelState &state, BevVert *bv, BoundVert *vpipe, bool midline, const float3 &co)
static int tri_corner_test (const BevelState &state, const BevVert *bv)
static VMesh tri_corner_adj_vmesh (BevelState &state, BevVert *bv)
Representative face / edge selection

Mirrors the BMesh choose_rep_face, boundvert_rep_face, and frep_for_center_poly functions used to select which original face should be the "example" for new bevel faces. The same 6-criterion lexicographic tie-breaking rule is used.

static bool face_point_inside_test (const ExtendableMesh &emesh, const int f, const float3 co)
static void get_incident_edges (const ExtendableMesh &emesh, const int f, const int v_idx, int *r_e1, int *r_e2)
static int find_face_internal_boundverts (const ExtendableMesh &emesh, const BevVert *bv, const int f, BoundVert *(r_internal[3]))
static float projected_boundary_area (const BevelState &state, BevVert *bv, const int f)
static bool is_bad_uv_poly (const BevelState &state, BevVert *bv, const int frep)
static int choose_rep_face (const BevelState &state, const Span< int > faces)
static int boundvert_rep_face (const BoundVert *v, int *r_fother)
static int find_closer_edge (const ExtendableMesh &emesh, const float3 &co, const int e1, const int e2)
static int snap_edge_for_center_vmesh_vert (const int i, const int n_bndv, const int eprev, const int enext, const Span< int > bndv_rep_faces, const int center_frep, const Span< bool > frep_beats_next)
static void snap_edges_for_vmesh_vert (const int i, const int j, const int k, const int ns, const int ns2, const int n_bndv, const int eprev, const int enext, const int enextnext, const Span< int > bndv_rep_faces, const int center_frep, const Span< bool > frep_beats_next, int r_snap_edges[4])
static int frep_for_center_poly (const BevelState &state, const BevVert *bv)
VMesh face builders
static int bevel_build_poly (BevelState &state, BevVert *bv)
static void bevel_build_trifan (BevelState &state, BevVert *bv)
static void bevel_vert_two_edges (BevelState &state, BevVert *bv)
static void bevel_build_rings (BevelState &state, BevVert *bv)
Face rebuild
static int count_ccw_edges_between (const EdgeHalf *e1, const EdgeHalf *e2)
static int bev_rebuild_polygon (BevelState &state, const int f_idx)
static void bevel_rebuild_existing_polygons (BevelState &state, Vector< int > &r_rebuilt_orig_faces, int &r_rebuilt_face_0)
Edge polygon construction
static bool bevvert_is_weld_cross (const BevVert *bv)
static void bevel_build_edge_polygons (BevelState &state, const int edge_index)
VMesh building
static BoundVert * pipe_test (const BevelState &state, BevVert *bv)
static VMesh pipe_adj_vmesh (BevelState &state, BevVert *bv, BoundVert *vpipe)
static VMesh square_out_adj_vmesh (BevelState &state, BevVert *bv)
static void build_vmesh (BevelState &state, BevVert *bv)
Output mesh assembly
static std::optional< NewCornerInterpData > resolve_new_corner_interp_data (const ExtendableMesh &emesh, const int nc, const int new_face_fallback)
static void compute_face_interp_weights (const ExtendableMesh &emesh, const int f_src, const float3 &co, MutableSpan< float > weights)
static NewCornerInterpWeights compute_new_corner_interp_weights (const ExtendableMesh &emesh)
static void interpolate_new_corner_attribute_from_faces (const NewCornerInterpWeights &interp_weights, const GSpan src, GMutableSpan dst)
static void fill_new_corner_uvs (BevelState &state, const NewCornerInterpWeights &interp_weights)
static void merge_uvs (BevelState &state)
static void bevel_extend_edge_data (BevelState &state)
static bool try_propagate_single_value (const bke::AttributeIter &iter, const GVArray &src, const IndexMask &edges_new_no_src, bke::MutableAttributeAccessor &dst_attrs)
static std::optional< Mesh * > build_output_mesh (const BevelState &state, const NewCornerInterpWeights &interp_weights, const bke::AttributeFilter &attribute_filter)

Enumeration Type Documentation

◆ AngleKind

Enumerator
ANGLE_SMALLER 
ANGLE_STRAIGHT 
ANGLE_LARGER 

Definition at line 2443 of file mesh_bevel.cc.

Function Documentation

◆ add_new_bound_vert()

◆ adj_vmesh()

◆ adjust_bound_vert()

void blender::geometry::construct::adjust_bound_vert ( BoundVert * bndv,
const float3 & co )
static

◆ adjust_miter_coords()

◆ adjust_miter_inner_coords()

◆ bev_ccw_test()

int blender::geometry::construct::bev_ccw_test ( const ExtendableMesh & emesh,
const int a,
const int b,
const int f )
static

◆ bev_rebuild_polygon()

◆ bevel_build_edge_polygons()

void blender::geometry::construct::bevel_build_edge_polygons ( BevelState & state,
const int edge_index )
static

◆ bevel_build_poly()

◆ bevel_build_rings()

◆ bevel_build_trifan()

◆ bevel_edge_order_extend()

◆ bevel_extend_edge_data()

◆ bevel_rebuild_existing_polygons()

void blender::geometry::construct::bevel_rebuild_existing_polygons ( BevelState & state,
Vector< int > & r_rebuilt_orig_faces,
int & r_rebuilt_face_0 )
static

◆ bevel_vert_construct()

◆ bevel_vert_two_edges()

◆ bevvert_is_weld_cross()

bool blender::geometry::construct::bevvert_is_weld_cross ( const BevVert * bv)
static

Returns true when bv is a "weld cross": 4 edges, 2 beveled, opposite each other. Matches BMesh's bevvert_is_weld_cross.

Definition at line 5115 of file mesh_bevel.cc.

References bevvert_is_weld_cross(), blender::geometry::BevVert::edgecount, blender::geometry::BevVert::edges, and blender::geometry::BevVert::selcount.

Referenced by bevel_build_edge_polygons(), and bevvert_is_weld_cross().

◆ boundvert_rep_face()

int blender::geometry::construct::boundvert_rep_face ( const BoundVert * v,
int * r_fother )
static

Return a good representative face for faces created around/near BoundVert v. Mirrors BMesh's boundvert_rep_face. Face indices are original mesh indices; -1 means none. If r_fother is non-null, a secondary candidate (or -1) is stored there.

Definition at line 4132 of file mesh_bevel.cc.

References boundvert_rep_face(), and blender::v.

Referenced by bevel_build_poly(), bevel_build_rings(), bevel_build_trifan(), and boundvert_rep_face().

◆ build_boundary()

◆ build_boundary_terminal_edge()

void blender::geometry::construct::build_boundary_terminal_edge ( const BevelState & state,
BevVert * bv,
EdgeHalf * efirst,
const bool construct )
static

◆ build_boundary_vertex_only()

◆ build_output_mesh()

std::optional< Mesh * > blender::geometry::construct::build_output_mesh ( const BevelState & state,
const NewCornerInterpWeights & interp_weights,
const bke::AttributeFilter & attribute_filter )
static

Definition at line 7412 of file mesh_bevel.cc.

References blender::bke::AttributeFilter::allow_skip(), blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::BKE_mesh_copy_parameters_for_eval(), blender::BKE_mesh_new_nomain(), blender::BLI_assert(), BLI_assert_unreachable, build_output_mesh(), blender::index_mask::build_reverse_map(), blender::index_mask::IndexMask::complement(), blender::VectorSet< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::array_utils::copy(), blender::MutableSpan< T >::copy_from(), blender::bke::Corner, blender::GMutableSpan::data(), blender::bke::AttributeIter::data_type, blender::CPPType::default_value(), blender::bke::AttributeIter::domain, blender::e, blender::bke::Edge, blender::geometry::BevelAttributeOutputs::edge_face_id, blender::geometry::EdgeFace, blender::Mesh::edges_num, ELEM, blender::bke::Face, blender::Mesh::faces_num, blender::CPPType::fill_assign_indices(), blender::bke::GSpanAttributeWriter::finish(), blender::bke::SpanAttributeWriter< T >::finish(), blender::bke::AttributeAccessor::foreach_attribute(), blender::index_mask::IndexMask::foreach_index(), blender::IndexMask::from_bools(), blender::array_utils::gather(), blender::bke::attribute_math::gather(), blender::bke::attribute_math::gather_group_to_group(), blender::offset_indices::gather_selected_offsets(), blender::bke::AttributeIter::get(), blender::exec_mode::grain_size(), blender::IndexRange::index_range(), blender::Span< T >::index_range(), blender::array_utils::indices_non_negative(), interpolate_new_corner_attribute_from_faces(), blender::MutableSpan< T >::is_empty(), blender::geometry::ExtendableMesh::kill_edges_array(), blender::geometry::ExtendableMesh::kill_faces_array(), blender::geometry::ExtendableMesh::kill_verts_array(), blender::bke::AttributeAccessor::lookup(), blender::bke::MutableAttributeAccessor::lookup_for_write_span(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_only_span(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_span(), blender::geometry::ExtendableMesh::mesh, blender::bke::mesh_is_valid(), blender::geometry::BevelAttributeOutputs::mid_edge_id, blender::geometry::MidEdge, blender::bke::AttributeIter::name, blender::geometry::ExtendableMesh::new_corner_edges(), blender::geometry::ExtendableMesh::new_corner_uvs(), blender::geometry::ExtendableMesh::new_corner_verts(), blender::geometry::ExtendableMesh::new_edge_examples(), blender::geometry::ExtendableMesh::new_edge_kinds(), blender::geometry::ExtendableMesh::new_edge_seam_overrides(), blender::geometry::ExtendableMesh::new_edge_sharp_overrides(), blender::geometry::ExtendableMesh::new_edges(), blender::geometry::ExtendableMesh::new_face_examples(), blender::geometry::ExtendableMesh::new_face_kinds(), blender::geometry::ExtendableMesh::new_face_offsets(), blender::geometry::ExtendableMesh::new_faces_num(), blender::geometry::ExtendableMesh::new_vert_examples(), blender::geometry::ExtendableMesh::new_vert_positions(), blender::geometry::BevelAttributeOutputs::outer_edge_id, blender::geometry::OuterEdge, blender::bke::Point, blender::index_mask::IndexMask::size(), blender::Span< T >::size(), blender::bke::GSpanAttributeWriter::span, blender::bke::SpanAttributeWriter< T >::span, state, blender::bke::String, blender::offset_indices::sum_group_sizes(), blender::GMutableSpan::take_back(), blender::MutableSpan< T >::take_back(), blender::blender::Span< T >::take_front(), blender::GMutableSpan::take_front(), blender::MutableSpan< T >::take_front(), try_propagate_single_value(), blender::GVArrayCommon::type(), blender::v, blender::geometry::BevelAttributeOutputs::vertex_face_id, blender::geometry::VertexFace, and blender::Mesh::verts_num.

Referenced by build_output_mesh(), and blender::geometry::mesh_bevel().

◆ build_vmesh()

void blender::geometry::construct::build_vmesh ( BevelState & state,
BevVert * bv )
static

Main vmesh builder for a single beveled vertex. Allocates the NewVert grid, creates boundary vertices in ExtendableMesh, computes profile coordinates, then dispatches to the appropriate per-kind builder.

Definition at line 5411 of file mesh_bevel.cc.

References blender::geometry::Adj, adj_vmesh(), bevel_build_poly(), bevel_build_rings(), bevel_build_trifan(), bevel_vert_two_edges(), blender::geometry::VMesh::boundstart, build_vmesh(), blender::geometry::profile::calculate_vm_profiles(), blender::geometry::NewVert::co, blender::geometry::VMesh::count, blender::geometry::Cutoff, blender::geometry::BoundVert::ebev, ELEM, blender::geometry::profile::get_profile_point(), blender::geometry::BoundVert::index, blender::geometry::geom::is_canon(), blender::geometry::VMesh::mesh, blender::geometry::VMesh::mesh_kind, blender::geometry::geom::mesh_vert(), blender::geometry::profile::move_weld_profile_planes(), blender::geometry::BoundVert::next, blender::geometry::None, blender::geometry::BoundVert::nv, pipe_adj_vmesh(), pipe_test(), blender::geometry::Poly, blender::geometry::profile::PRO_LINE_R, blender::geometry::profile::PRO_SQUARE_R, blender::geometry::BoundVert::profile, blender::geometry::VMesh::seg, blender::geometry::BevVert::selcount, blender::geometry::profile::set_profile_params(), square_out_adj_vmesh(), state, blender::geometry::Profile::super_r, blender::geometry::TriFan, blender::geometry::BevVert::v, blender::geometry::NewVert::v, blender::geometry::Vertices, blender::geometry::BevVert::vmesh, and blender::geometry::geom::vmesh_copy_equiv_verts().

Referenced by build_vmesh(), and blender::geometry::mesh_bevel().

◆ check_edge_data_seam_sharp_edges()

◆ choose_rep_face()

int blender::geometry::construct::choose_rep_face ( const BevelState & state,
const Span< int > faces )
static

Choose the best representative face index from faces (original face indices, -1 = skip).

Tie-breaking criteria (lower value wins at each priority):

  1. UV-connected-component id (uv_layer_info.face_component; 0 when no UV layers).
  2. Reserved for a future "face selected" attribute; always 0.0f for now.
  3. Material index (material_index face attribute; 0 when absent).
  4. Higher z-coordinate of face center (stored negated so "higher wins" = lower value).
  5. Lower x-coordinate of face center.
  6. Lower y-coordinate of face center.

Returns -1 when every candidate is -1.

Definition at line 4039 of file mesh_bevel.cc.

References blender::BLI_assert(), choose_rep_face(), blender::bke::Face, blender::geometry::uv::UVMapInfo::face_component, float, blender::Array< T, InlineBufferCapacity, Allocator >::is_empty(), blender::blender::Span< T >::is_empty(), blender::bke::AttributeAccessor::lookup(), blender::Span< T >::size(), state, blender::bke::AttributeReader< T >::varray, and VEC_VALUE_LEN.

Referenced by bevel_build_edge_polygons(), bevel_build_rings(), choose_rep_face(), and frep_for_center_poly().

◆ closer_v3_v3v3v3()

float3 blender::geometry::construct::closer_v3_v3v3v3 ( const float3 & a,
const float3 & b,
const float3 & v )
static

Copy whichever of a and b is closer to v into r.

Definition at line 6214 of file mesh_bevel.cc.

References b, closer_v3_v3v3v3(), blender::math::distance_squared(), and blender::v.

Referenced by closer_v3_v3v3v3(), and square_out_adj_vmesh().

◆ compute_face_interp_weights()

void blender::geometry::construct::compute_face_interp_weights ( const ExtendableMesh & emesh,
const int f_src,
const float3 & co,
MutableSpan< float > weights )
static

◆ compute_new_corner_interp_weights()

◆ count_ccw_edges_between()

int blender::geometry::construct::count_ccw_edges_between ( const EdgeHalf * e1,
const EdgeHalf * e2 )
static

Returns the number of EdgeHalf steps CCW from e1 to e2 around the same BevVert ring. Mirrors BMesh's count_ccw_edges_between.

Definition at line 4814 of file mesh_bevel.cc.

References count_ccw_edges_between(), and blender::e.

Referenced by bev_rebuild_polygon(), and count_ccw_edges_between().

◆ cubic_subdiv()

◆ determine_uv_vert_connectivity()

void blender::geometry::construct::determine_uv_vert_connectivity ( BevelState & state,
const int v )
static

For each UV map, group the corners of vertex v into buckets of corners whose UV coordinates coincide (within STD_UV_CONNECT_LIMIT). Store the result in state.uv_vert_maps[i][v], one entry per UV layer.

This is the Mesh equivalent of the BMesh determine_uv_vert_connectivity function. Corners play the role of BMesh loops; #uv::UVMapInfo::layers supplies the UV values.

Definition at line 5578 of file mesh_bevel.cc.

References blender::BLI_assert(), blender::compare_v2v2(), determine_uv_vert_connectivity(), state, STD_UV_CONNECT_LIMIT, and blender::v.

Referenced by determine_uv_vert_connectivity(), and blender::geometry::mesh_bevel().

◆ edge_has_miter()

bool blender::geometry::construct::edge_has_miter ( const BevelState & state,
const EdgeHalf * e,
int v )
static

◆ edges_angle_kind()

◆ edges_face_connected_at_vert()

bool blender::geometry::construct::edges_face_connected_at_vert ( const ExtendableMesh & emesh,
const int e1,
const int e2 )
static

◆ face_point_inside_test()

bool blender::geometry::construct::face_point_inside_test ( const ExtendableMesh & emesh,
const int f,
const float3 co )
static

◆ fast_bevel_edge_order()

◆ fill_new_corner_uvs()

◆ fill_profile_fracs()

void blender::geometry::construct::fill_profile_fracs ( const BevelState & state,
const BoundVert * bndv,
MutableSpan< float > frac,
const int ns )
static

◆ fill_vmesh_fracs()

void blender::geometry::construct::fill_vmesh_fracs ( VMesh * vm,
MutableSpan< float > frac,
int i )
static

◆ find_bevel_edge_order()

◆ find_closer_edge()

int blender::geometry::construct::find_closer_edge ( const ExtendableMesh & emesh,
const float3 & co,
const int e1,
const int e2 )
static

◆ find_edge_half_for_edge()

EdgeHalf * blender::geometry::construct::find_edge_half_for_edge ( BevVert * bv,
const int edge_index )
static

◆ find_face_internal_boundverts()

int blender::geometry::construct::find_face_internal_boundverts ( const ExtendableMesh & emesh,
const BevVert * bv,
const int f,
BoundVert * r_internal[3] )
static

Find which BoundVert positions of bv are inside face f when both are projected to 2D. At most 3 can be interior (the maximum between two edges including miters). Returns the number of internal vertices found. Mirrors BMesh's find_face_internal_boundverts.

Definition at line 3935 of file mesh_bevel.cc.

References blender::BLI_assert(), blender::geometry::VMesh::boundstart, blender::BMVert::co, face_point_inside_test(), find_face_internal_boundverts(), blender::v, and blender::geometry::BevVert::vmesh.

Referenced by bevel_build_poly(), bevel_build_trifan(), find_face_internal_boundverts(), and projected_boundary_area().

◆ find_other_end_edge_half()

EdgeHalf * blender::geometry::construct::find_other_end_edge_half ( const BevelState & state,
EdgeHalf * e,
BevVert ** r_bvother )
static

◆ frep_for_center_poly()

int blender::geometry::construct::frep_for_center_poly ( const BevelState & state,
const BevVert * bv )
static

Pick a good representative face for the center polygon of bv. Collects one candidate per beveled edge (choosing from fprev/fnext), eliminates duplicates, then calls choose_rep_face on the shortlist. Mirrors BMesh's frep_for_center_poly.

Definition at line 4295 of file mesh_bevel.cc.

References blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), choose_rep_face(), blender::e, blender::geometry::BevVert::edgecount, blender::geometry::BevVert::edges, frep_for_center_poly(), is_bad_uv_poly(), blender::geometry::BevVert::selcount, and state.

Referenced by bevel_build_poly(), bevel_build_rings(), bevel_build_trifan(), and frep_for_center_poly().

◆ get_incident_edges()

void blender::geometry::construct::get_incident_edges ( const ExtendableMesh & emesh,
const int f,
const int v_idx,
int * r_e1,
int * r_e2 )
static

◆ interp_range()

int blender::geometry::construct::interp_range ( const Span< float > frac,
const int n,
const float f,
float * r_rest )
static

Definition at line 5675 of file mesh_bevel.cc.

References frac(), and interp_range().

Referenced by interp_range(), and interp_vmesh().

◆ interp_vmesh()

◆ interpolate_new_corner_attribute_from_faces()

◆ is_bad_uv_poly()

bool blender::geometry::construct::is_bad_uv_poly ( const BevelState & state,
BevVert * bv,
const int frep )
static

Returns true if choosing face frep as the representative for bv's center polygon would result in a degenerate (near-zero area) UV polygon. Mirrors BMesh's is_bad_uv_poly.

Definition at line 4019 of file mesh_bevel.cc.

References blender::BLI_assert(), is_bad_uv_poly(), projected_boundary_area(), state, and blender::geometry::BevVert::vmesh.

Referenced by frep_for_center_poly(), and is_bad_uv_poly().

◆ make_cube_corner_adj_vmesh()

VMesh blender::geometry::construct::make_cube_corner_adj_vmesh ( BevelState & state)
static

Builds the canonical unit-simplex vmesh for the cube corner case by:

  1. constructing a seg=2 seed with profile-parameterized boundary midpoints,
  2. iteratively doubling via cubic_subdiv until seg >= nseg,
  3. resampling to nseg via interp_vmesh,
  4. snapping every grid point to the superellipsoid x^r + y^r + z^r = 1. Equivalent to BMesh's make_cube_corner_adj_vmesh.

The PRO_SQUARE_R and PRO_SQUARE_IN_R cases are handled analytically by make_cube_corner_square / make_cube_corner_square_in because the subdivision

  • snap pipeline would trip the z == 0 assertion in snap_to_superellipsoid (the square cases assume a 2-D cross-section, not a 3-D superellipsoid).

Definition at line 6080 of file mesh_bevel.cc.

References blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), blender::geometry::profile::calculate_profile_segments(), blender::geometry::NewVert::co, blender::math::cross(), cubic_subdiv(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), blender::geometry::Profile::end, blender::geometry::profile::get_profile_point(), blender::geometry::Profile::height, blender::geometry::BoundVert::index, interp_vmesh(), M_SQRT1_3, make_cube_corner_adj_vmesh(), make_cube_corner_square(), make_cube_corner_square_in(), blender::geometry::geom::make_unit_square_map(), blender::geometry::geom::mesh_vert(), blender::geometry::Profile::middle, new_adj_vmesh(), blender::geometry::BoundVert::next, blender::math::normalize(), blender::geometry::BoundVert::nv, blender::geometry::Profile::plane_co, blender::geometry::Profile::plane_no, blender::geometry::BoundVert::prev, blender::geometry::profile::PRO_LINE_R, blender::geometry::profile::PRO_SQUARE_IN_R, blender::geometry::profile::PRO_SQUARE_R, blender::geometry::Profile::prof_co, blender::geometry::Profile::prof_co_2, blender::geometry::BoundVert::profile, blender::geometry::Profile::proj_dir, blender::geometry::VMesh::seg, blender::geometry::ProfileSpacing::seg_2, snap_to_superellipsoid(), blender::geometry::Profile::special_params, blender::geometry::Profile::start, state, blender::geometry::Profile::super_r, blender::geometry::geom::vmesh_copy_equiv_verts(), blender::geometry::ProfileSpacing::xvals, blender::geometry::ProfileSpacing::xvals_2, blender::geometry::ProfileSpacing::yvals, and blender::geometry::ProfileSpacing::yvals_2.

Referenced by make_cube_corner_adj_vmesh(), and tri_corner_adj_vmesh().

◆ make_cube_corner_square()

VMesh blender::geometry::construct::make_cube_corner_square ( const int nseg)
static

Special case for cube corner when r == PRO_SQUARE_R (outward straight sides). Builds the VMesh analytically by setting each canonical grid point to lie on the axis-aligned face of the octant cube (co[i] = 1, the other two coords ramp linearly). Mirrors BMesh's make_cube_corner_square.

Definition at line 5999 of file mesh_bevel.cc.

References blender::geometry::NewVert::co, float, blender::geometry::BoundVert::index, blender::geometry::geom::is_canon(), make_cube_corner_square(), blender::geometry::geom::mesh_vert(), new_adj_vmesh(), blender::geometry::BoundVert::next, blender::geometry::BoundVert::nv, blender::geometry::BoundVert::prev, and blender::geometry::geom::vmesh_copy_equiv_verts().

Referenced by make_cube_corner_adj_vmesh(), and make_cube_corner_square().

◆ make_cube_corner_square_in()

VMesh blender::geometry::construct::make_cube_corner_square_in ( const int nseg)
static

◆ make_unit_cube_map()

float4x4 blender::geometry::construct::make_unit_cube_map ( const float3 & va,
const float3 & vb,
const float3 & vc,
const float3 & vd )
static

Builds a 4x4 matrix that maps the unit cube (with vertices at +/- 1) to the tetrahedron formed by va, vb, vc (the three boundary verts) and vd (the original beveled vertex). Same as BMesh's make_unit_cube_map.

Definition at line 5979 of file mesh_bevel.cc.

References make_unit_cube_map().

Referenced by make_unit_cube_map(), and tri_corner_adj_vmesh().

◆ merge_uvs()

void blender::geometry::construct::merge_uvs ( BevelState & state)
static

Average UV values at shared seam vertices.

Mirrors what BMesh achieves via #update_uv_vert_map + #bevel_merge_uvs:

  1. Source corners at original vertices - average source-corner UV values within each pre-built UVVertBucket (same as before).
  2. New corners at original vertices - should not exist for correctly built bevel geometry (bevel vertices are killed before output), but handled for safety via source-bucket lookup.
  3. New corners at new (profile-arc) vertices - look up the arc vertex's parent bevel vertex via #vert_bev_origin, then use that parent's UV bucket structure to group new corners. New corners whose face representative's source corner at the parent vertex belongs to the same UV bucket get averaged together. This correctly handles both seam-free meshes (one bucket: all corners merge) and seam meshes (multiple buckets: corners from different UV islands remain separate).

Definition at line 7167 of file mesh_bevel.cc.

References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Mesh::corners_num, blender::Mesh::faces_num, float, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::items(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr(), merge_uvs(), blender::geometry::ExtendableMesh::mesh, blender::geometry::ExtendableMesh::new_corner_uvs(), blender::geometry::ExtendableMesh::new_corner_verts(), blender::geometry::ExtendableMesh::new_face_examples(), blender::geometry::ExtendableMesh::new_face_offsets(), blender::geometry::ExtendableMesh::new_faces_num(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::geometry::ExtendableMesh::src_corner_verts, blender::geometry::ExtendableMesh::src_faces, state, blender::geometry::ExtendableMesh::vert_bev_origin(), blender::geometry::ExtendableMesh::vert_to_new_corners(), and blender::Mesh::verts_num.

Referenced by merge_uvs(), and blender::geometry::mesh_bevel().

◆ nearly_parallel_normalized()

bool blender::geometry::construct::nearly_parallel_normalized ( const float3 & d1,
const float3 & d2 )
static

◆ new_adj_vmesh()

◆ next_bev()

EdgeHalf * blender::geometry::construct::next_bev ( BevVert * bv,
EdgeHalf * from_e )
static

Definition at line 2421 of file mesh_bevel.cc.

References blender::e, blender::geometry::BevVert::edges, and next_bev().

Referenced by build_boundary(), and next_bev().

◆ next_edgehalf_bev()

EdgeHalf * blender::geometry::construct::next_edgehalf_bev ( const BevelState & state,
EdgeHalf * start_edge,
bool toward_bv,
BevVert ** r_bv )
static

Helper function to return the next Beveled EdgeHalf along a path.

Parameters
toward_bvWhether the direction to travel points toward or away from the BevVert connected to the current EdgeHalf.
r_bvThe BevVert connected to the EdgeHalf – updated if we're traveling to the other EdgeHalf of an original edge.
Note
This only returns the most parallel edge if it's the most parallel by at least 10 degrees. This is a somewhat arbitrary choice, but it makes sure that consistent orientation paths only continue in obvious ways.

Definition at line 2923 of file mesh_bevel.cc.

References blender::geometry::geom::BEVEL_SMALL_ANG_DOT, blender::math::dot(), blender::geometry::EdgeHalf::e, find_other_end_edge_half(), blender::geometry::EdgeHalf::is_bev, blender::geometry::EdgeHalf::next, next_edgehalf_bev(), blender::math::normalize(), and state.

Referenced by next_edgehalf_bev(), and regularize_profile_orientation().

◆ offset_in_plane()

◆ pipe_adj_vmesh()

VMesh blender::geometry::construct::pipe_adj_vmesh ( BevelState & state,
BevVert * bv,
BoundVert * vpipe )
static

See pipe_test for conditions that make 'pipe'; vpipe is the return value from that. We want to make an ADJ mesh but then snap the vertices to the profile in a plane perpendicular to the pipes.

Definition at line 6317 of file mesh_bevel.cc.

References adj_vmesh(), ELEM, float, blender::geometry::BoundVert::index, blender::math::interpolate(), blender::geometry::geom::is_canon(), blender::geometry::geom::mesh_vert(), blender::geometry::BoundVert::next, pipe_adj_vmesh(), snap_to_pipe_profile(), state, and blender::geometry::BevVert::vmesh.

Referenced by build_vmesh(), and pipe_adj_vmesh().

◆ pipe_test()

◆ projected_boundary_area()

◆ regularize_profile_orientation()

void blender::geometry::construct::regularize_profile_orientation ( const BevelState & state,
int edge_index )
static

Starting along any beveled edge, travel along the chain / cycle of beveled edges including that edge, marking consistent profile orientations along the way. Orientations are marked by setting whether the BoundVert that contains each profile's information is the side of the profile's start or not. Ported from BMesh's regularize_profile_orientation.

Definition at line 3006 of file mesh_bevel.cc.

References blender::geometry::NewVert::co, find_edge_half_for_edge(), blender::geometry::EdgeHalf::is_bev, blender::geometry::BoundVert::is_profile_start, blender::geometry::EdgeHalf::leftv, next_edgehalf_bev(), blender::geometry::BoundVert::nv, regularize_profile_orientation(), blender::geometry::EdgeHalf::rightv, state, and blender::geometry::EdgeHalf::visited_rpo.

Referenced by blender::geometry::mesh_bevel(), and regularize_profile_orientation().

◆ resolve_new_corner_interp_data()

std::optional< NewCornerInterpData > blender::geometry::construct::resolve_new_corner_interp_data ( const ExtendableMesh & emesh,
const int nc,
const int new_face_fallback )
static

◆ set_bound_vert_seams()

void blender::geometry::construct::set_bound_vert_seams ( const BevelState & state,
BevVert * bv,
bool mark_seam,
bool mark_sharp )
static

◆ snap_edge_for_center_vmesh_vert()

int blender::geometry::construct::snap_edge_for_center_vmesh_vert ( const int i,
const int n_bndv,
const int eprev,
const int enext,
const Span< int > bndv_rep_faces,
const int center_frep,
const Span< bool > frep_beats_next )
static

Returns the edge to snap to for the center-polygon vertex at BoundVert index i. Mirrors BMesh's snap_edge_for_center_vmesh_vert. eprev / enext are the bevel edges for BoundVert i-1 / i respectively (-1 = none).

Definition at line 4211 of file mesh_bevel.cc.

References snap_edge_for_center_vmesh_vert().

Referenced by snap_edge_for_center_vmesh_vert(), and snap_edges_for_vmesh_vert().

◆ snap_edges_for_vmesh_vert()

void blender::geometry::construct::snap_edges_for_vmesh_vert ( const int i,
const int j,
const int k,
const int ns,
const int ns2,
const int n_bndv,
const int eprev,
const int enext,
const int enextnext,
const Span< int > bndv_rep_faces,
const int center_frep,
const Span< bool > frep_beats_next,
int r_snap_edges[4] )
static

Fills r_snap_edges[4] with per-corner snap-edge indices for the ring quad at (i, j, k). Mirrors BMesh's snap_edges_for_vmesh_vert. Only meaningful for odd segment counts; for even ns all entries are set to -1.

Definition at line 4235 of file mesh_bevel.cc.

References blender::BLI_assert(), ELEM, snap_edge_for_center_vmesh_vert(), and snap_edges_for_vmesh_vert().

Referenced by bevel_build_rings(), and snap_edges_for_vmesh_vert().

◆ snap_to_pipe_profile()

◆ snap_to_superellipsoid()

void blender::geometry::construct::snap_to_superellipsoid ( float3 & co,
const float super_r,
const bool midline )
static

Snaps co to lie on the superellipsoid x^r + y^r + z^r = 1. When r == PRO_CIRCLE_R normalizes the vector; for the square cases snaps to the nearest axis-aligned face. Only used for cube corner special cases.

Definition at line 5909 of file mesh_bevel.cc.

References blender::math::abs(), b, blender::geometry::geom::BEVEL_EPSILON_D, blender::BLI_assert(), ELEM, blender::math::max(), blender::math::min(), blender::math::normalize(), powf, blender::geometry::profile::PRO_CIRCLE_R, blender::geometry::profile::PRO_SQUARE_IN_R, blender::geometry::profile::PRO_SQUARE_R, snap_to_superellipsoid(), blender::x, y, and z().

Referenced by make_cube_corner_adj_vmesh(), snap_to_pipe_profile(), and snap_to_superellipsoid().

◆ square_out_adj_vmesh()

VMesh blender::geometry::construct::square_out_adj_vmesh ( BevelState & state,
BevVert * bv )
static

Special case of VMesh when profile == 1 and there are 3 or more beveled edges. We want the effect of parallel offset lines (n/2 of them) on each side of the center, for even n. Wherever they intersect with each other between two successive beveled edges, those intersections are part of the vmesh rings. We have to move the boundary edges too – the usual method is to make one profile plane between successive BoundVerts, but for the effect we want here, there will be two planes, one on each side of the original edge. At the moment, this is not called for odd number of segments, though code does something if it is.

Definition at line 6395 of file mesh_bevel.cc.

References blender::math::angle_between(), ANGLE_SMALLER, ANGLE_STRAIGHT, blender::geometry::geom::BEVEL_SMALL_ANG, blender::geometry::VMesh::boundstart, closer_v3_v3v3v3(), blender::math::closest_to_line_segment(), blender::geometry::NewVert::co, blender::geometry::EdgeHalf::e, blender::geometry::geom::edge_other_vert(), edges_angle_kind(), blender::geometry::BoundVert::efirst, blender::geometry::BoundVert::elast, float, blender::math::interpolate(), blender::geometry::BoundVert::is_arc_start, blender::geometry::BoundVert::is_patch_start, blender::math::isect_line_line(), blender::geometry::geom::mesh_vert(), blender::geometry::Profile::middle, blender::math::midpoint(), new_adj_vmesh(), blender::geometry::BoundVert::next, blender::math::normalize(), blender::geometry::BoundVert::nv, blender::geometry::BoundVert::prev, blender::geometry::BoundVert::profile, sinf, square_out_adj_vmesh(), state, blender::geometry::BevVert::v, blender::geometry::BevVert::vmesh, and blender::geometry::geom::vmesh_copy_equiv_verts().

Referenced by build_vmesh(), and square_out_adj_vmesh().

◆ tri_corner_adj_vmesh()

◆ tri_corner_test()

int blender::geometry::construct::tri_corner_test ( const BevelState & state,
const BevVert * bv )
static

Tests whether bv is a good candidate for the tri-corner cube-corner special case. Returns 1 when it qualifies (3-vert, equal offsets, ~90 degree corner angles), 0 when the count is 3 but other conditions are not met, and -1 when it definitely should not use this path.

Definition at line 6625 of file mesh_bevel.cc.

References blender::math::abs(), blender::math::angle_between(), blender::geometry::geom::BEVEL_EPSILON_D, blender::math::cross(), blender::math::dot(), blender::e, blender::geometry::BevVert::edgecount, blender::geometry::BevVert::edges, float, M_PI, M_PI_2, M_PI_4, blender::geometry::profile::PRO_SQUARE_R, blender::geometry::BevVert::selcount, blender::geometry::ExtendableMesh::src_face_normals, blender::geometry::ExtendableMesh::src_positions, state, tri_corner_test(), blender::geometry::BevVert::v, blender::geometry::Vertices, and blender::geometry::BevVert::vmesh.

Referenced by adj_vmesh(), and tri_corner_test().

◆ try_propagate_single_value()