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

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

Function Documentation

◆ calculate_profile()

◆ calculate_profile_segments()

void blender::geometry::profile::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

◆ calculate_vm_profiles()

void blender::geometry::profile::calculate_vm_profiles ( BevelState & state,
BevVert * bv,
VMesh * vm )
static

◆ find_even_superellipse_chords()

void blender::geometry::profile::find_even_superellipse_chords ( int n,
float r,
MutableSpan< double > xvals,
MutableSpan< double > yvals )
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().

◆ find_even_superellipse_chords_general()

void blender::geometry::profile::find_even_superellipse_chords_general ( int seg,
float r,
MutableSpan< double > xvals,
MutableSpan< double > yvals )
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().

◆ find_profile_fullness()

float blender::geometry::profile::find_profile_fullness ( BevelState * bs)
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().

◆ find_superellipse_chord_endpoint()

double blender::geometry::profile::find_superellipse_chord_endpoint ( double x0,
double dtarget,
float r,
bool rbig )
static

◆ get_profile_point()

◆ move_profile_plane()

void blender::geometry::profile::move_profile_plane ( BoundVert * bndv,
const float3 bmvert_co )
static

◆ move_weld_profile_planes()

void blender::geometry::profile::move_weld_profile_planes ( BoundVert * bndv1,
BoundVert * bndv2,
const float3 v_co )
static

◆ project_to_edge()

float3 blender::geometry::profile::project_to_edge ( const ExtendableMesh & emesh,
int e_idx,
const float3 & co_a,
const float3 & co_b )
static

◆ set_profile_params()

void blender::geometry::profile::set_profile_params ( const BevelState & state,
const BevVert * bv,
BoundVert * bndv )
static

◆ set_profile_spacing()

void blender::geometry::profile::set_profile_spacing ( BevelState * bs,
ProfileSpacing * pro_spacing,
bool custom )
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.

Parameters
pro_spacingThe 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().

◆ superellipse_co()

double blender::geometry::profile::superellipse_co ( double x,
float r,
bool rbig )
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().

Variable Documentation

◆ PRO_CIRCLE_R

◆ PRO_LINE_R

◆ PRO_SQUARE_IN_R

◆ PRO_SQUARE_R