|
Blender V5.3
|
Functions | |
| static double | superellipse_co (double x, float r, bool rbig) |
| static double | find_superellipse_chord_endpoint (double x0, double dtarget, float r, bool rbig) |
| static void | find_even_superellipse_chords_general (int seg, float r, MutableSpan< double > xvals, MutableSpan< double > yvals) |
| static void | find_even_superellipse_chords (int n, float r, MutableSpan< double > xvals, MutableSpan< double > yvals) |
| static float | find_profile_fullness (BevelState *bs) |
| static void | set_profile_spacing (BevelState *bs, ProfileSpacing *pro_spacing, bool custom) |
Profile parameter setup and evaluation | |
| static void | set_profile_params (const BevelState &state, const BevVert *bv, BoundVert *bndv) |
| static void | move_profile_plane (BoundVert *bndv, float3 bmvert_co) |
| static float3 | project_to_edge (const ExtendableMesh &emesh, int e_idx, const float3 &co_a, const float3 &co_b) |
| static void | move_weld_profile_planes (BoundVert *bndv1, BoundVert *bndv2, const float3 v_co) |
| static void | calculate_profile_segments (const Profile &pro, const float4x4 &map, const bool use_map, const bool reversed, const int ns, const double *xvals, const double *yvals, MutableSpan< float3 > r_prof_co) |
| static void | calculate_profile (BevelState &state, BoundVert *bndv, bool reversed, bool) |
| static float3 | get_profile_point (const BevelState &state, const Profile *pro, int i, int nseg) |
| static void | calculate_vm_profiles (BevelState &state, BevVert *bv, VMesh *vm) |
Variables | |
| constexpr float | PRO_SQUARE_R = 1e4f |
| constexpr float | PRO_CIRCLE_R = 2.0f |
| constexpr float | PRO_LINE_R = 1.0f |
| constexpr float | PRO_SQUARE_IN_R = 0.0f |
|
static |
Computes the prof_co (and optionally prof_co_2) arrays for bndv->profile, applying the superellipse (or custom profile) 2D-to-3D mapping and projection. No-op when params.segments == 1.
Definition at line 3708 of file mesh_bevel.cc.
References blender::Array< T, InlineBufferCapacity, Allocator >::as_mutable_span(), calculate_profile(), calculate_profile_segments(), blender::Array< T, InlineBufferCapacity, Allocator >::data(), blender::geometry::Profile::end, blender::Array< T, InlineBufferCapacity, Allocator >::is_empty(), blender::geometry::geom::make_unit_square_map(), blender::geometry::Profile::middle, PRO_LINE_R, blender::geometry::Profile::prof_co, blender::geometry::Profile::prof_co_2, blender::geometry::BoundVert::profile, blender::geometry::ProfileSpacing::seg_2, blender::geometry::Profile::start, state, blender::geometry::Profile::super_r, blender::geometry::ProfileSpacing::xvals, blender::geometry::ProfileSpacing::xvals_2, blender::geometry::ProfileSpacing::yvals, and blender::geometry::ProfileSpacing::yvals_2.
Referenced by blender::geometry::construct::bevel_vert_two_edges(), calculate_profile(), and calculate_vm_profiles().
|
static |
Fills r_prof_co with 3D positions for each segment point of the profile, mapped from the 2D superellipse using the map matrix and projected along proj_dir.
Definition at line 3661 of file mesh_bevel.cc.
References calculate_profile_segments(), blender::geometry::Profile::end, float, blender::math::interpolate(), blender::math::is_zero(), blender::math::isect_line_plane(), blender::geometry::Profile::plane_co, blender::geometry::Profile::plane_no, blender::geometry::Profile::proj_dir, blender::geometry::Profile::start, and blender::math::transform_point().
Referenced by calculate_profile(), calculate_profile_segments(), and blender::geometry::construct::make_cube_corner_adj_vmesh().
|
static |
Sets profile parameters for all BoundVert entries of vm and computes their profile coordinate arrays. This is the last step before vertex creation.
Definition at line 3787 of file mesh_bevel.cc.
References blender::geometry::VMesh::boundstart, calculate_profile(), calculate_vm_profiles(), blender::geometry::BoundVert::is_arc_start, blender::geometry::BoundVert::is_patch_start, blender::geometry::BoundVert::is_profile_start, blender::geometry::BoundVert::next, blender::geometry::BoundVert::profile, set_profile_params(), blender::geometry::Profile::special_params, and state.
Referenced by blender::geometry::construct::build_vmesh(), and calculate_vm_profiles().
|
static |
Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse function in the first quadrant. For special profiles (linear, arc, rectangle) the point can be calculated easily, for any other profile a more expensive search procedure must be used because there is no known closed form for equidistant parametrization. xvals and yvals should be size n+1.
Definition at line 3241 of file mesh_bevel.cc.
References blender::math::cos(), find_even_superellipse_chords(), find_even_superellipse_chords_general(), M_PI_2, PRO_CIRCLE_R, PRO_LINE_R, PRO_SQUARE_IN_R, PRO_SQUARE_R, and blender::math::sin().
Referenced by find_even_superellipse_chords(), and set_profile_spacing().
|
static |
This search procedure to find equidistant points (x,y) in the first superellipse quadrant works for every superellipse exponent but is more expensive than known solutions for special cases. Call the point on superellipse that intersects x=y line mx. For r>=1 use only the range x in [0,mx] and mirror the rest along x=y line, for r<1 use only x in [mx,1]. Points are initially spaced and iteratively repositioned to have the same distance.
Definition at line 3150 of file mesh_bevel.cc.
References blender::e, find_even_superellipse_chords_general(), find_superellipse_chord_endpoint(), blender::math::pow(), blender::math::sqrt(), and superellipse_co().
Referenced by find_even_superellipse_chords(), and find_even_superellipse_chords_general().
|
static |
Find the profile's "fullness," which is the fraction of the space it takes up way from the boundvert's centroid to the original vertex for a non-custom profile, or in the case of a custom profile, the average "height" of the profile points along its centerline.
Definition at line 3312 of file mesh_bevel.cc.
References blender::geometry::BevelParameters::custom_profile_samples, find_profile_fullness(), float, blender::geometry::BevelState::params, PRO_CIRCLE_R, PRO_LINE_R, blender::geometry::BevelState::pro_spacing, blender::geometry::BevelState::pro_super_r, blender::geometry::BevelParameters::segments, blender::geometry::BevelParameters::shape, blender::geometry::ProfileSpacing::xvals, and blender::geometry::ProfileSpacing::yvals.
Referenced by find_profile_fullness(), and blender::geometry::BevelState::initialize_profile_data().
|
static |
Definition at line 3087 of file mesh_bevel.cc.
References abs, blender::e, find_superellipse_chord_endpoint(), blender::math::pow(), blender::math::sqrt(), and superellipse_co().
Referenced by find_even_superellipse_chords_general(), and find_superellipse_chord_endpoint().
|
static |
Returns the 3D coordinate of profile point i out of nseg for pro. When nseg == params.segments, indexes into prof_co; otherwise uses the higher-resolution prof_co_2 with sub-sampling.
Definition at line 3769 of file mesh_bevel.cc.
References blender::BLI_assert(), blender::geometry::Profile::end, get_profile_point(), blender::Array< T, InlineBufferCapacity, Allocator >::is_empty(), blender::is_power_of_2_i(), blender::geometry::Profile::prof_co, blender::geometry::Profile::prof_co_2, blender::geometry::Profile::start, and state.
Referenced by blender::geometry::construct::adj_vmesh(), blender::geometry::construct::bevel_vert_two_edges(), blender::geometry::construct::build_vmesh(), blender::geometry::construct::cubic_subdiv(), blender::geometry::construct::fill_profile_fracs(), get_profile_point(), and blender::geometry::construct::make_cube_corner_adj_vmesh().
|
static |
Adjusts the profile plane of bndv->profile so that it contains the plane through bndv->profile.start, bndv->profile.end, and bmvert_co. Mirrors BMesh's move_profile_plane. Sets special_params = true to prevent calculate_vm_profiles from resetting the parameters. Currently used only in #build_boundary_terminal_edge.
Definition at line 3580 of file mesh_bevel.cc.
References blender::math::abs(), blender::geometry::geom::BEVEL_EPSILON_BIG, blender::math::cross(), blender::math::dot(), dot3(), blender::geometry::Profile::end, blender::math::is_zero(), move_profile_plane(), blender::math::normalize(), blender::math::normalize_and_get_length(), blender::geometry::Profile::plane_no, blender::geometry::BoundVert::profile, blender::geometry::Profile::proj_dir, blender::geometry::Profile::special_params, and blender::geometry::Profile::start.
Referenced by blender::geometry::construct::build_boundary_terminal_edge(), and move_profile_plane().
|
static |
Adjusts the profile planes for the two BoundVert instances involved in a weld. Moves the plane to the one most likely to contain the profile projection intersections. Sets special_params = true on both to prevent recalculation. Mirrors BMesh's move_weld_profile_planes.
Definition at line 3621 of file mesh_bevel.cc.
References blender::math::abs(), blender::geometry::geom::BEVEL_EPSILON_D, blender::geometry::NewVert::co, blender::math::cross(), blender::math::dot(), blender::math::is_zero(), move_weld_profile_planes(), blender::math::normalize_and_get_length(), blender::geometry::BoundVert::nv, blender::geometry::Profile::plane_no, blender::geometry::BoundVert::profile, blender::geometry::Profile::proj_dir, and blender::geometry::Profile::special_params.
Referenced by blender::geometry::construct::build_vmesh(), and move_weld_profile_planes().
|
static |
Definition at line 3444 of file mesh_bevel.cc.
References blender::geometry::ExtendableMesh::edge_verts(), blender::math::isect_line_line(), project_to_edge(), and blender::geometry::ExtendableMesh::vert_position().
Referenced by project_to_edge(), and set_profile_params().
|
static |
Sets profile.start/middle/end/plane_co/plane_no/proj_dir/super_r for a BoundVert. Ported from BMesh's set_profile_params; edge access uses ExtendableMesh instead of BMesh.
Definition at line 3467 of file mesh_bevel.cc.
References blender::geometry::NewVert::co, blender::math::cross(), blender::BMVert::e, blender::e, blender::geometry::BoundVert::ebev, blender::geometry::Profile::end, blender::geometry::BoundVert::is_arc_start, blender::math::isect_line_line(), blender::geometry::Profile::middle, blender::math::midpoint(), blender::geometry::geom::nearly_parallel(), blender::geometry::BoundVert::next, blender::math::normalize(), blender::geometry::BoundVert::nv, blender::geometry::Profile::plane_co, blender::geometry::Profile::plane_no, PRO_CIRCLE_R, PRO_LINE_R, blender::geometry::BoundVert::profile, blender::geometry::Profile::proj_dir, project_to_edge(), blender::geometry::BevVert::selcount, set_profile_params(), blender::geometry::ExtendableMesh::src_edges, blender::geometry::ExtendableMesh::src_positions, blender::geometry::Profile::start, state, blender::geometry::Profile::super_r, blender::geometry::BevVert::v, blender::geometry::ExtendableMesh::vert_position(), and blender::geometry::Vertices.
Referenced by blender::geometry::construct::build_boundary_terminal_edge(), blender::geometry::construct::build_vmesh(), calculate_vm_profiles(), and set_profile_params().
|
static |
Fills the ProfileSpacing struct with the 2D coordinates for the profile's vertices. The superellipse used for multi-segment profiles does not have a closed-form way to generate evenly spaced points along an arc. We use an expensive search procedure to find the parameter values that lead to bp->seg even chords. We also want spacing for a number of segments that is a power of 2 >= bp->seg (but at least 4). Use doubles because otherwise we cannot come close to float precision for final results.
| pro_spacing | The struct to fill. Changes depending on whether there needs to be a separate miter profile. |
Helper lambda: linearly resamples the pre-sampled custom profile at n evenly spaced intervals. The input src has segments + 1 entries (from the caller who built it at the node-eval resolution). When n != segments we linearly interpolate to re-sample at the new resolution (typically seg_2, a power-of-two used during subdivision).
Definition at line 3367 of file mesh_bevel.cc.
References blender::geometry::BevelParameters::custom_profile_samples, find_even_superellipse_chords(), float, blender::geometry::BevelState::params, blender::power_of_2_max_i(), blender::geometry::BevelState::pro_spacing, blender::geometry::BevelState::pro_super_r, blender::geometry::ProfileSpacing::seg_2, blender::geometry::BevelParameters::segments, set_profile_spacing(), blender::Span< T >::size(), blender::x, blender::geometry::ProfileSpacing::xvals, blender::geometry::ProfileSpacing::xvals_2, y, blender::geometry::ProfileSpacing::yvals, and blender::geometry::ProfileSpacing::yvals_2.
Referenced by blender::geometry::BevelState::initialize_profile_data(), and set_profile_spacing().
|
static |
Get the coordinate on the superellipse (x^r + y^r = 1), at parameter value x (or, if !rbig, mirrored (y=x)-line). rbig should be true if r > 1.0 and false if <= 1.0. Assume r > 0.0.
Definition at line 3073 of file mesh_bevel.cc.
References blender::BLI_assert(), blender::math::pow(), superellipse_co(), and blender::x.
Referenced by find_even_superellipse_chords_general(), find_superellipse_chord_endpoint(), and superellipse_co().
|
constexpr |
Definition at line 3063 of file mesh_bevel.cc.
Referenced by find_even_superellipse_chords(), find_profile_fullness(), blender::geometry::BevelState::initialize_profile_data(), set_profile_params(), and blender::geometry::construct::snap_to_superellipsoid().
|
constexpr |
Definition at line 3064 of file mesh_bevel.cc.
Referenced by blender::geometry::construct::build_vmesh(), calculate_profile(), find_even_superellipse_chords(), find_profile_fullness(), blender::geometry::BevelState::initialize_profile_data(), blender::geometry::construct::make_cube_corner_adj_vmesh(), and set_profile_params().
|
constexpr |
Definition at line 3065 of file mesh_bevel.cc.
Referenced by blender::geometry::construct::adj_vmesh(), find_even_superellipse_chords(), blender::geometry::BevelState::initialize_profile_data(), blender::geometry::construct::make_cube_corner_adj_vmesh(), and blender::geometry::construct::snap_to_superellipsoid().
|
constexpr |
Definition at line 3062 of file mesh_bevel.cc.
Referenced by blender::geometry::construct::build_vmesh(), find_even_superellipse_chords(), blender::geometry::BevelState::initialize_profile_data(), blender::geometry::construct::make_cube_corner_adj_vmesh(), blender::geometry::construct::snap_to_superellipsoid(), and blender::geometry::construct::tri_corner_test().