|
Blender V5.0
|
#include <algorithm>#include "MEM_guardedalloc.h"#include "DNA_curveprofile_types.h"#include "DNA_meshdata_types.h"#include "DNA_modifier_types.h"#include "BLI_alloca.h"#include "BLI_map.hh"#include "BLI_math_base.h"#include "BLI_math_base_safe.h"#include "BLI_math_geom.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_memarena.h"#include "BLI_set.hh"#include "BLI_utildefines.h"#include "BLI_vector.hh"#include "BKE_curveprofile.h"#include "BKE_customdata.hh"#include "BKE_deform.hh"#include "BKE_mesh.hh"#include "BKE_mesh_mapping.hh"#include "eigen_capi.h"#include "bmesh.hh"#include "bmesh_bevel.hh"#include "./intern/bmesh_private.hh"Go to the source code of this file.
Classes | |
| struct | NewVert |
| struct | EdgeHalf |
| struct | Profile |
| struct | ProfileSpacing |
| struct | MathLayerInfo |
| struct | UVFace |
| struct | BoundVert |
| struct | VMesh |
| struct | BevVert |
| struct | BevelParams |
Macros | |
| #define | BEVEL_EPSILON_D 1e-6 |
| #define | BEVEL_EPSILON 1e-6f |
| #define | BEVEL_EPSILON_SQ 1e-12f |
| #define | BEVEL_EPSILON_BIG 1e-4f |
| #define | BEVEL_EPSILON_BIG_SQ 1e-8f |
| #define | BEVEL_EPSILON_ANG DEG2RADF(2.0f) |
| #define | BEVEL_SMALL_ANG DEG2RADF(10.0f) |
| #define | BEVEL_SMALL_ANG_DOT (1.0f - cosf(BEVEL_SMALL_ANG)) |
| #define | BEVEL_EPSILON_ANG_DOT (1.0f - cosf(BEVEL_EPSILON_ANG)) |
| #define | BEVEL_MAX_ADJUST_PCT 10.0f |
| #define | BEVEL_MAX_AUTO_ADJUST_PCT 300.0f |
| #define | BEVEL_MATCH_SPEC_WEIGHT 0.2 |
| #define | PRO_SQUARE_R 1e4f |
| #define | PRO_CIRCLE_R 2.0f |
| #define | PRO_LINE_R 1.0f |
| #define | PRO_SQUARE_IN_R 0.0f |
| #define | BM_ELEM_LONG_TAG (1 << 6) |
| #define | EDGE_OUT 4 |
| #define | VERT_OUT 8 |
| #define | VEC_VALUE_LEN 6 |
| #define | BEVEL_GOOD_ANGLE 0.1f |
| #define | BEV_EXTEND_EDGE_DATA_CHECK(eh, flag) |
| #define | HASNOT_SEAMSHARP(eh, flag) |
| #define | BM_BEVEL_EDGE_TAG_ENABLE(bme) |
| #define | BM_BEVEL_EDGE_TAG_DISABLE(bme) |
| #define | BM_BEVEL_EDGE_TAG_TEST(bme) |
| #define | CIRCLE_FULLNESS_SEGS 11 |
Typedefs | |
| using | UVVertBucket = Set<BMLoop *> |
| using | UVVertMap = Map<BMVert *, Vector<UVVertBucket>> |
Enumerations | |
| enum | MeshKind { M_NONE , M_POLY , M_ADJ , M_TRI_FAN , M_CUTOFF } |
| enum | FKind { F_NONE , F_ORIG , F_VERT , F_EDGE , F_RECON } |
| enum | AngleKind { ANGLE_SMALLER = -1 , ANGLE_STRAIGHT = 0 , ANGLE_LARGER = 1 } |
Functions | |
| static void | flag_out_edge (BMesh *bm, BMEdge *bme) |
| static void | flag_out_vert (BMesh *bm, BMVert *bmv) |
| static void | disable_flag_out_edge (BMesh *bm, BMEdge *bme) |
| static void | record_face_kind (BevelParams *bp, BMFace *f, FKind fkind) |
| static FKind | get_face_kind (BevelParams *bp, BMFace *f) |
| static bool | nearly_parallel (const float d1[3], const float d2[3]) |
| static bool | nearly_parallel_normalized (const float d1[3], const float d2[3]) |
| static BoundVert * | add_new_bound_vert (MemArena *mem_arena, VMesh *vm, const float co[3]) |
| BLI_INLINE void | adjust_bound_vert (BoundVert *bv, const float co[3]) |
| static NewVert * | mesh_vert (VMesh *vm, int i, int j, int k) |
| static void | create_mesh_bmvert (BMesh *bm, VMesh *vm, int i, int j, int k, BMVert *eg) |
| static void | copy_mesh_vert (VMesh *vm, int ito, int jto, int kto, int ifrom, int jfrom, int kfrom) |
| static EdgeHalf * | find_edge_half (BevVert *bv, BMEdge *bme) |
| static BevVert * | find_bevvert (BevelParams *bp, BMVert *bmv) |
| static UVFace * | find_uv_face (BevelParams *bp, BMFace *bmf) |
| static EdgeHalf * | find_other_end_edge_half (BevelParams *bp, EdgeHalf *e, BevVert **r_bvother) |
| static EdgeHalf * | next_bev (BevVert *bv, EdgeHalf *from_e) |
| static int | count_ccw_edges_between (EdgeHalf *e1, EdgeHalf *e2) |
| static bool | edges_face_connected_at_vert (BMEdge *bme1, BMEdge *bme2) |
| static UVFace * | register_uv_face (BevelParams *bp, BMFace *fnew, BMFace *frep, BMFace **frep_arr) |
| static void | update_uv_vert_map (BevelParams *bp, UVFace *uv_face, BMVert *bv, Map< BMVert *, BMVert * > *nv_bv_map) |
| static void | determine_uv_vert_connectivity (BevelParams *bp, BMesh *bm, BMVert *v) |
| static void | bevel_merge_uvs (BevelParams *bp, BMesh *bm) |
| static BMFace * | boundvert_rep_face (BoundVert *v, BMFace **r_fother) |
| static BMFace * | bev_create_ngon (BevelParams *bp, BMesh *bm, BMVert **vert_arr, const int totv, BMFace **face_arr, BMFace *facerep, BMEdge **snap_edge_arr, BMVert *bv, Map< BMVert *, BMVert * > *nv_bv_map, int mat_nr, bool do_interp) |
| static bool | contig_ldata_across_loops (BMesh *bm, BMLoop *l1, BMLoop *l2, int layer_index) |
| static bool | contig_ldata_across_edge (BMesh *bm, BMEdge *e, BMFace *f1, BMFace *f2) |
| static void | swap_face_components (int *face_component, int totface, int c1, int c2) |
| static void | uv_vert_map_init (BevelParams *bp, BMesh *bm) |
| static void | uv_vert_map_pop (BevelParams *bp, BMVert *v) |
| static void | math_layer_info_init (BevelParams *bp, BMesh *bm) |
| static BMFace * | choose_rep_face (BevelParams *bp, BMFace **face, int nfaces) |
| static void | slide_dist (EdgeHalf *e, BMVert *v, float d, float r_slideco[3]) |
| static bool | is_outside_edge (EdgeHalf *e, const float co[3], BMVert **ret_closer_v) |
| static AngleKind | edges_angle_kind (EdgeHalf *e1, EdgeHalf *e2, BMVert *v) |
| static bool | point_between_edges (const float co[3], BMVert *v, BMFace *f, EdgeHalf *e1, EdgeHalf *e2) |
| static bool | edge_edge_angle_less_than_180 (const BMEdge *e1, const BMEdge *e2, const BMFace *f) |
| static void | offset_meet_lines_percent_or_absolute (BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, BMVert *v, float r_l1a[3], float r_l1b[3], float r_l2a[3], float r_l2b[3]) |
| static void | offset_meet (BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, bool edges_between, float meetco[3], const EdgeHalf *e_in_plane) |
| static bool | offset_meet_edge (EdgeHalf *e1, EdgeHalf *e2, BMVert *v, float meetco[3], float *r_angle) |
| static bool | good_offset_on_edge_between (EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, BMVert *v) |
| static bool | offset_on_edge_between (BevelParams *bp, EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, BMVert *v, float meetco[3], float *r_sinratio) |
| static void | offset_in_plane (EdgeHalf *e, const float plane_no[3], bool left, float r_co[3]) |
| static void | project_to_edge (const BMEdge *e, const float co_a[3], const float co_b[3], float projco[3]) |
| static void | set_profile_params (BevelParams *bp, BevVert *bv, BoundVert *bndv) |
| static void | move_profile_plane (BoundVert *bndv, BMVert *bmvert) |
| static void | move_weld_profile_planes (BevVert *bv, BoundVert *bndv1, BoundVert *bndv2) |
| static int | bev_ccw_test (BMEdge *a, BMEdge *b, BMFace *f) |
| static bool | make_unit_square_map (const float va[3], const float vmid[3], const float vb[3], float r_mat[4][4]) |
| static void | make_unit_cube_map (const float va[3], const float vb[3], const float vc[3], const float vd[3], float r_mat[4][4]) |
| static double | superellipse_co (double x, float r, bool rbig) |
| static void | get_profile_point (BevelParams *bp, const Profile *pro, int i, int nseg, float r_co[3]) |
| static void | calculate_profile_segments (const Profile *profile, const float map[4][4], const bool use_map, const bool reversed, const int ns, const double *xvals, const double *yvals, float *r_prof_co) |
| static void | calculate_profile (BevelParams *bp, BoundVert *bndv, bool reversed, bool miter) |
| static void | snap_to_superellipsoid (float co[3], const float super_r, bool midline) |
| static void | check_edge_data_seam_sharp_edges (BevVert *bv, int flag) |
| static void | bevel_extend_edge_data_ex (BevVert *bv, int flag) |
| static void | bevel_extend_edge_data (BevVert *bv) |
| static void | bevel_edges_sharp_boundary (BMesh *bm, BevelParams *bp) |
| static void | bevel_harden_normals (BevelParams *bp, BMesh *bm) |
| Harden normals for bevel. | |
| static void | bevel_set_weighted_normal_face_strength (BMesh *bm, BevelParams *bp) |
| static void | set_bound_vert_seams (BevVert *bv, bool mark_seam, bool mark_sharp) |
| static bool | eh_on_plane (EdgeHalf *e) |
| static void | calculate_vm_profiles (BevelParams *bp, BevVert *bv, VMesh *vm) |
| static void | build_boundary_vertex_only (BevelParams *bp, BevVert *bv, bool construct) |
| static void | build_boundary_terminal_edge (BevelParams *bp, BevVert *bv, EdgeHalf *efirst, const bool construct) |
| static void | adjust_miter_coords (BevelParams *bp, BevVert *bv, EdgeHalf *emiter) |
| static void | adjust_miter_inner_coords (BevelParams *bp, BevVert *bv, EdgeHalf *emiter) |
| static void | build_boundary (BevelParams *bp, BevVert *bv, bool construct) |
| static EdgeHalf * | next_edgehalf_bev (BevelParams *bp, EdgeHalf *start_edge, bool toward_bv, BevVert **r_bv) |
| static void | regularize_profile_orientation (BevelParams *bp, BMEdge *bme) |
| static void | adjust_the_cycle_or_chain (BoundVert *vstart, bool iscycle) |
| static void | adjust_offsets (BevelParams *bp, BMesh *bm) |
| static BoundVert * | pipe_test (BevVert *bv) |
| static VMesh * | new_adj_vmesh (MemArena *mem_arena, int count, int seg, BoundVert *bounds) |
| static NewVert * | mesh_vert_canon (VMesh *vm, int i, int j, int k) |
| static bool | is_canon (VMesh *vm, int i, int j, int k) |
| static void | vmesh_copy_equiv_verts (VMesh *vm) |
| static void | vmesh_center (VMesh *vm, float r_cent[3]) |
| static void | avg4 (float co[3], const NewVert *v0, const NewVert *v1, const NewVert *v2, const NewVert *v3) |
| static float | sabin_gamma (int n) |
| static void | fill_vmesh_fracs (VMesh *vm, float *frac, int i) |
| static void | fill_profile_fracs (BevelParams *bp, BoundVert *bndv, float *frac, int ns) |
| static int | interp_range (const float *frac, int n, const float f, float *r_rest) |
| static VMesh * | interp_vmesh (BevelParams *bp, VMesh *vm_in, int nseg) |
| static VMesh * | cubic_subdiv (BevelParams *bp, VMesh *vm_in) |
| static VMesh * | make_cube_corner_square (MemArena *mem_arena, int nseg) |
| static VMesh * | make_cube_corner_square_in (MemArena *mem_arena, int nseg) |
| static VMesh * | make_cube_corner_adj_vmesh (BevelParams *bp) |
| static int | tri_corner_test (BevelParams *bp, BevVert *bv) |
| static VMesh * | tri_corner_adj_vmesh (BevelParams *bp, BevVert *bv) |
| static VMesh * | adj_vmesh (BevelParams *bp, BevVert *bv) |
| static void | snap_to_pipe_profile (BoundVert *vpipe, bool midline, float co[3]) |
| static VMesh * | pipe_adj_vmesh (BevelParams *bp, BevVert *bv, BoundVert *vpipe) |
| static void | get_incident_edges (BMFace *f, BMVert *v, BMEdge **r_e1, BMEdge **r_e2) |
| static BMEdge * | find_closer_edge (float *co, BMEdge *e1, BMEdge *e2) |
| static int | find_face_internal_boundverts (const BevVert *bv, const BMFace *f, BoundVert *(r_internal[3])) |
| static float | projected_boundary_area (BevVert *bv, BMFace *f) |
| static bool | is_bad_uv_poly (BevVert *bv, BMFace *frep) |
| static BMFace * | frep_for_center_poly (BevelParams *bp, BevVert *bv) |
| static void | build_center_ngon (BevelParams *bp, BMesh *bm, BevVert *bv, int mat_nr) |
| static void | build_square_in_vmesh (BevelParams *bp, BMesh *bm, BevVert *bv, VMesh *vm1) |
| static void | closer_v3_v3v3v3 (float r[3], const float a[3], const float b[3], const float v[3]) |
| static VMesh * | square_out_adj_vmesh (BevelParams *bp, BevVert *bv) |
| static BMEdge * | snap_edge_for_center_vmesh_vert (int i, int n_bndv, BMEdge *eprev, BMEdge *enext, BMFace **bndv_rep_faces, BMFace *center_frep, const bool *frep_beats_next) |
| static void | snap_edges_for_vmesh_vert (int i, int j, int k, int ns, int ns2, int n_bndv, BMEdge *eprev, BMEdge *enext, BMEdge *enextnext, BMFace **bndv_rep_faces, BMFace *center_frep, const bool *frep_beats_next, BMEdge *r_snap_edges[4]) |
| static void | bevel_build_rings (BevelParams *bp, BMesh *bm, BevVert *bv, BoundVert *vpipe) |
| static void | bevel_build_cutoff (BevelParams *bp, BMesh *bm, BevVert *bv) |
| static BMFace * | bevel_build_poly (BevelParams *bp, BMesh *bm, BevVert *bv) |
| static void | bevel_build_trifan (BevelParams *bp, BMesh *bm, BevVert *bv) |
| static void | bevel_vert_two_edges (BevelParams *bp, BMesh *bm, BevVert *bv) |
| static void | build_vmesh (BevelParams *bp, BMesh *bm, BevVert *bv) |
| static float | edge_face_angle (EdgeHalf *e) |
| static int | bevel_edge_order_extend (BMesh *bm, BevVert *bv, int i) |
| static bool | fast_bevel_edge_order (BevVert *bv) |
| static void | find_bevel_edge_order (BMesh *bm, BevVert *bv, BMEdge *first_bme) |
| static BevVert * | bevel_vert_construct (BMesh *bm, BevelParams *bp, BMVert *v) |
| static bool | bev_rebuild_polygon (BMesh *bm, BevelParams *bp, BMFace *f) |
| static void | bevel_rebuild_existing_polygons (BMesh *bm, BevelParams *bp, BMVert *v, Set< BMFace * > &rebuilt_orig_faces) |
| static void | bevel_reattach_wires (BMesh *bm, BevelParams *bp, BMVert *v) |
| static bool | bevvert_is_weld_cross (BevVert *bv) |
| static void | weld_cross_attrs_copy (BMesh *bm, BevVert *bv, VMesh *vm, int vmindex, EdgeHalf *e) |
| static void | bevel_build_edge_polygons (BMesh *bm, BevelParams *bp, BMEdge *bme) |
| 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, double *xvals, double *yvals) |
| static void | find_even_superellipse_chords (int n, float r, double *xvals, double *yvals) |
| static float | find_profile_fullness (BevelParams *bp) |
| static void | set_profile_spacing (BevelParams *bp, ProfileSpacing *pro_spacing, bool custom) |
| static float | geometry_collide_offset (BevelParams *bp, EdgeHalf *eb) |
| static float | vertex_collide_offset (BevelParams *bp, EdgeHalf *ea) |
| static void | bevel_limit_offset (BevelParams *bp, BMesh *bm) |
| void | BM_mesh_bevel (BMesh *bm, const float offset, const int offset_type, const int profile_type, const int segments, const float profile, const bool affect_type, const bool use_weights, const bool limit_offset, const MDeformVert *dvert, const int vertex_group, const int mat, const bool loop_slide, const bool mark_seam, const bool mark_sharp, const bool harden_normals, const int face_strength_mode, const int miter_outer, const int miter_inner, const float spread, const CurveProfile *custom_profile, const int vmesh_method, const int bweight_offset_vert, const int bweight_offset_edge) |
Main functions for beveling a BMesh (used by the tool and modifier)
Definition in file bmesh_bevel.cc.
| #define BEV_EXTEND_EDGE_DATA_CHECK | ( | eh, | |
| flag ) |
Definition at line 2470 of file bmesh_bevel.cc.
| #define BEVEL_EPSILON 1e-6f |
Definition at line 55 of file bmesh_bevel.cc.
Referenced by bevel_build_cutoff(), bevel_vert_construct(), geometry_collide_offset(), interp_vmesh(), move_weld_profile_planes(), snap_to_superellipsoid(), and tri_corner_test().
| #define BEVEL_EPSILON_ANG DEG2RADF(2.0f) |
Definition at line 59 of file bmesh_bevel.cc.
Referenced by make_unit_square_map(), nearly_parallel(), offset_meet(), pipe_test(), and point_between_edges().
| #define BEVEL_EPSILON_ANG_DOT (1.0f - cosf(BEVEL_EPSILON_ANG)) |
Difference in dot products that corresponds to 2.0 degree difference between vectors.
Definition at line 64 of file bmesh_bevel.cc.
Referenced by nearly_parallel_normalized().
| #define BEVEL_EPSILON_BIG 1e-4f |
Definition at line 57 of file bmesh_bevel.cc.
Referenced by build_boundary_terminal_edge(), eh_on_plane(), is_bad_uv_poly(), is_outside_edge(), move_profile_plane(), and pipe_test().
| #define BEVEL_EPSILON_BIG_SQ 1e-8f |
Definition at line 58 of file bmesh_bevel.cc.
| #define BEVEL_EPSILON_D 1e-6 |
Definition at line 54 of file bmesh_bevel.cc.
Referenced by slide_dist(), and snap_to_pipe_profile().
| #define BEVEL_EPSILON_SQ 1e-12f |
Definition at line 56 of file bmesh_bevel.cc.
Referenced by adj_vmesh().
| #define BEVEL_GOOD_ANGLE 0.1f |
Definition at line 1712 of file bmesh_bevel.cc.
Referenced by offset_meet_edge().
| #define BEVEL_MATCH_SPEC_WEIGHT 0.2 |
Definition at line 67 of file bmesh_bevel.cc.
Referenced by adjust_the_cycle_or_chain().
| #define BEVEL_MAX_ADJUST_PCT 10.0f |
Definition at line 65 of file bmesh_bevel.cc.
| #define BEVEL_MAX_AUTO_ADJUST_PCT 300.0f |
Definition at line 66 of file bmesh_bevel.cc.
| #define BEVEL_SMALL_ANG DEG2RADF(10.0f) |
Definition at line 60 of file bmesh_bevel.cc.
Referenced by offset_meet(), and square_out_adj_vmesh().
| #define BEVEL_SMALL_ANG_DOT (1.0f - cosf(BEVEL_SMALL_ANG)) |
Difference in dot products that corresponds to 10 degree difference between vectors.
Definition at line 62 of file bmesh_bevel.cc.
Referenced by next_edgehalf_bev().
| #define BM_BEVEL_EDGE_TAG_DISABLE | ( | bme | ) |
Definition at line 6225 of file bmesh_bevel.cc.
Referenced by bevel_edge_order_extend(), bevel_vert_construct(), and fast_bevel_edge_order().
| #define BM_BEVEL_EDGE_TAG_ENABLE | ( | bme | ) |
Definition at line 6224 of file bmesh_bevel.cc.
Referenced by bevel_edge_order_extend(), bevel_vert_construct(), fast_bevel_edge_order(), and find_bevel_edge_order().
| #define BM_BEVEL_EDGE_TAG_TEST | ( | bme | ) |
Definition at line 6226 of file bmesh_bevel.cc.
Referenced by bevel_edge_order_extend(), fast_bevel_edge_order(), and find_bevel_edge_order().
| #define BM_ELEM_LONG_TAG (1 << 6) |
Definition at line 421 of file bmesh_bevel.cc.
Referenced by bevel_build_edge_polygons(), bevel_harden_normals(), and BM_mesh_bevel().
| #define CIRCLE_FULLNESS_SEGS 11 |
Referenced by find_profile_fullness().
| #define EDGE_OUT 4 |
Definition at line 424 of file bmesh_bevel.cc.
| #define HASNOT_SEAMSHARP | ( | eh, | |
| flag ) |
Definition at line 2486 of file bmesh_bevel.cc.
Referenced by check_edge_data_seam_sharp_edges().
| #define PRO_CIRCLE_R 2.0f |
Definition at line 161 of file bmesh_bevel.cc.
Referenced by BM_mesh_bevel(), find_even_superellipse_chords(), find_profile_fullness(), set_profile_params(), and snap_to_superellipsoid().
| #define PRO_LINE_R 1.0f |
Definition at line 162 of file bmesh_bevel.cc.
Referenced by add_new_bound_vert(), BM_mesh_bevel(), build_vmesh(), calculate_profile(), find_even_superellipse_chords(), find_profile_fullness(), and set_profile_params().
| #define PRO_SQUARE_IN_R 0.0f |
Definition at line 163 of file bmesh_bevel.cc.
Referenced by adj_vmesh(), bevel_build_rings(), BM_mesh_bevel(), find_even_superellipse_chords(), make_cube_corner_adj_vmesh(), and snap_to_superellipsoid().
| #define PRO_SQUARE_R 1e4f |
Definition at line 160 of file bmesh_bevel.cc.
Referenced by bevel_build_rings(), BM_mesh_bevel(), find_even_superellipse_chords(), make_cube_corner_adj_vmesh(), snap_to_superellipsoid(), and tri_corner_test().
| #define VEC_VALUE_LEN 6 |
Referenced by choose_rep_face().
| #define VERT_OUT 8 |
Definition at line 425 of file bmesh_bevel.cc.
| using UVVertBucket = Set<BMLoop *> |
Container for loops representing UV verts which should be merged together in a UV map.
Definition at line 335 of file bmesh_bevel.cc.
| using UVVertMap = Map<BMVert *, Vector<UVVertBucket>> |
Mapping of vertex to UV vert buckets (i.e. loops belonging to that BMVert key).
Definition at line 338 of file bmesh_bevel.cc.
| enum AngleKind |
Helper for keeping track of angle kind.
| Enumerator | |
|---|---|
| ANGLE_SMALLER | Angle less than 180 degrees. |
| ANGLE_STRAIGHT | 180 degree angle. |
| ANGLE_LARGER | Angle greater than 180 degrees. |
Definition at line 325 of file bmesh_bevel.cc.
| enum FKind |
Face classification.
Definition at line 311 of file bmesh_bevel.cc.
| enum MeshKind |
| Enumerator | |
|---|---|
| M_NONE | |
| M_POLY | |
| M_ADJ | |
| M_TRI_FAN | |
| M_CUTOFF | |
Definition at line 258 of file bmesh_bevel.cc.
Definition at line 485 of file bmesh_bevel.cc.
References BoundVert::adjchain, BoundVert::any_seam, BLI_memarena_alloc(), VMesh::boundstart, NewVert::co, copy_v3_v3(), VMesh::count, BoundVert::index, BoundVert::is_arc_start, BoundVert::is_patch_start, BoundVert::is_profile_start, mem_arena, BoundVert::next, BoundVert::nv, BoundVert::prev, PRO_LINE_R, BoundVert::profile, BoundVert::sinratio, Profile::super_r, and BoundVert::visited.
Referenced by build_boundary(), build_boundary_terminal_edge(), build_boundary_vertex_only(), make_cube_corner_adj_vmesh(), make_cube_corner_square(), and make_cube_corner_square_in().
|
static |
Definition at line 4714 of file bmesh_bevel.cc.
References add_v3_v3(), BEVEL_EPSILON_SQ, BEVEL_PROFILE_CUSTOM, VMesh::boundstart, BMVert::co, NewVert::co, copy_v3_v3(), VMesh::count, cubic_subdiv(), ProfileSpacing::fullness, get_profile_point(), i, interp_vmesh(), len_squared_v3(), madd_v3_v3v3fl(), BevelParams::mem_arena, mem_arena, mesh_vert(), mul_v3_fl(), new_adj_vmesh(), BoundVert::next, BoundVert::nv, BevelParams::pro_spacing, PRO_SQUARE_IN_R, BevelParams::pro_super_r, BoundVert::profile, BevelParams::profile_type, VMesh::seg, sub_v3_v3v3(), tri_corner_adj_vmesh(), tri_corner_test(), BevVert::v, BevVert::vmesh, and vmesh_copy_equiv_verts().
Referenced by bevel_build_rings(), and pipe_adj_vmesh().
| BLI_INLINE void adjust_bound_vert | ( | BoundVert * | bv, |
| const float | co[3] ) |
Definition at line 515 of file bmesh_bevel.cc.
References BLI_INLINE, NewVert::co, copy_v3_v3(), and BoundVert::nv.
Referenced by adjust_miter_coords(), build_boundary(), build_boundary_terminal_edge(), and build_boundary_vertex_only().
|
static |
Definition at line 3061 of file bmesh_bevel.cc.
References adjust_bound_vert(), BEVEL_MITER_ARC, BEVEL_MITER_PATCH, BLI_assert, BM_edge_other_vert(), BMVert::co, NewVert::co, copy_v3_v3(), EdgeHalf::e, BoundVert::elast, BoundVert::is_arc_start, isect_line_plane_v3(), madd_v3_v3v3fl(), Profile::middle, BevelParams::miter_outer, BoundVert::next, normalize_v3(), BoundVert::nv, BevelParams::offset, BoundVert::prev, BoundVert::profile, EdgeHalf::rightv, BevelParams::seg, sub_v3_v3v3(), BevVert::v, and v2.
Referenced by build_boundary().
|
static |
Definition at line 3110 of file bmesh_bevel.cc.
References BM_edge_other_vert(), VMesh::boundstart, BMVert::co, NewVert::co, copy_v3_v3(), e, BoundVert::elast, madd_v3_v3v3fl(), BoundVert::next, normalize_v3(), BoundVert::nv, BevelParams::spread, sub_v3_v3v3(), BevVert::v, v, and BevVert::vmesh.
Referenced by build_boundary().
|
static |
Adjust the offsets to try to make them, as much as possible, have even-width bevels with offsets that match their specs. The problem that we can try to ameliorate is that when loop slide is active, the meet point will probably not be the one that makes both sides have their specified width. And because both ends may be on loop slide edges, the widths at each end could be different.
It turns out that the dependent offsets either form chains or cycles, and we can process each of those separately.
Definition at line 3872 of file bmesh_bevel.cc.
References BoundVert::adjchain, adjust_the_cycle_or_chain(), BLI_assert, bm, BM_elem_flag_test, BM_ELEM_TAG, BM_ITER_MESH, BM_VERTS_OF_MESH, VMesh::boundstart, build_boundary(), BoundVert::eon, find_bevvert(), find_other_end_edge_half(), EdgeHalf::leftv, BoundVert::next, EdgeHalf::rightv, v, BoundVert::visited, and BevVert::vmesh.
Referenced by BM_mesh_bevel().
|
static |
Adjust the offsets for a single cycle or chain. For chains and some cycles, a fast solution exists. Otherwise, we set up and solve a linear least squares problem that tries to minimize the squared differences of lengths at each end of an edge, and (with smaller weight) the squared differences of the offsets from their specs.
Definition at line 3710 of file bmesh_bevel.cc.
References BEVEL_MATCH_SPEC_WEIGHT, BM_elem_index_get, EdgeHalf::e, EIG_linear_least_squares_solver_new(), EIG_linear_solver_delete(), EIG_linear_solver_matrix_add(), EIG_linear_solver_print_matrix(), EIG_linear_solver_right_hand_side_add(), EIG_linear_solver_solve(), EIG_linear_solver_variable_get(), float, i, EdgeHalf::offset_l, EdgeHalf::offset_r, printf, and v.
Referenced by adjust_offsets().
|
static |
Definition at line 4110 of file bmesh_bevel.cc.
References add_v3_v3(), add_v3_v3v3(), NewVert::co, mul_v3_fl(), and v2.
Referenced by cubic_subdiv().
Definition at line 2104 of file bmesh_bevel.cc.
References b, BM_face_edge_share_loop(), and BMLoop::next.
Referenced by bevel_vert_construct().
|
static |
Make ngon from verts alone. Make sure to properly copy face attributes and do custom data interpolation from corresponding elements of face_arr, if that is non-nullptr, else from facerep. If edge_arr is non-nullptr, then for interpolation purposes only, the corresponding elements of vert_arr are snapped to any non-nullptr edges in that array. If mat_nr >= 0 then the material of the face is set to that.
Definition at line 907 of file bmesh_bevel.cc.
References BLI_assert, bm, BM_CREATE_NOP, BM_EDGES_OF_FACE, BM_elem_attrs_copy(), BM_elem_flag_enable, BM_ELEM_TAG, BM_face_create_verts(), BM_ITER_ELEM, BM_loop_interp_from_face(), BM_LOOPS_OF_FACE, closest_to_line_segment_v3(), BMVert::co, copy_v3_v3(), flag_out_edge(), i, l, BMFace::mat_nr, register_uv_face(), update_uv_vert_map(), BMEdge::v1, and BMEdge::v2.
Referenced by bev_rebuild_polygon(), bevel_build_cutoff(), bevel_build_edge_polygons(), bevel_build_poly(), bevel_build_rings(), and build_center_ngon().
|
static |
Definition at line 6745 of file bmesh_bevel.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), bev_create_ngon(), BLI_assert, bm, BM_edge_exists(), BM_EDGES_OF_FACE, BM_elem_attrs_copy(), BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_SEAM, BM_ELEM_SMOOTH, BM_ELEM_TAG, BM_FACES_OF_EDGE, BM_ITER_ELEM, BM_LOOPS_OF_FACE, count_ccw_edges_between(), blender::Vector< T, InlineBufferCapacity, Allocator >::data(), disable_flag_out_edge(), BMLoop::e, e, F_RECON, find_bevvert(), find_edge_half(), i, l, EdgeHalf::leftv, mesh_vert(), BoundVert::next, BoundVert::prev, EdgeHalf::prev, EdgeHalf::profile_index, record_face_kind(), EdgeHalf::rightv, VMesh::seg, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), NewVert::v, v, and BevVert::vmesh.
Referenced by bevel_rebuild_existing_polygons().
|
static |
Builds the vertex mesh when the vertex mesh type is set to "cut off" with a face closing off each incoming edge's profile.
TODO(Hans): Make cutoff VMesh work with outer miter != sharp. This should be possible but there are two problems currently:
Definition at line 5752 of file bmesh_bevel.cc.
References bev_create_ngon(), BEVEL_EPSILON, BLI_memarena_alloc(), bm, VMesh::boundstart, NewVert::co, copy_v3_v3(), VMesh::count, create_mesh_bmvert(), cross_v3_v3v3(), dot_v3v3(), Profile::height, i, BoundVert::index, BoundVert::is_arc_start, BoundVert::is_patch_start, len_squared_v3v3(), length(), madd_v3_v3v3fl(), BevelParams::mat_nr, max_ii(), BevelParams::mem_arena, mesh_vert(), negate_v3(), BoundVert::next, BMVert::no, BoundVert::nv, Profile::plane_no, BoundVert::prev, printf, BoundVert::profile, BevelParams::seg, sqrtf, BevVert::v, NewVert::v, and BevVert::vmesh.
Referenced by build_vmesh().
|
static |
Build the bevel polygons along the selected Edge.
Definition at line 7077 of file bmesh_bevel.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), bev_create_ngon(), bevvert_is_weld_cross(), BLI_assert, bm, BM_edge_exists(), BM_edge_is_manifold(), BM_elem_attrs_copy(), BM_elem_flag_enable, BM_ELEM_LONG_TAG, BM_ITER_ELEM, BM_LOOPS_OF_FACE, choose_rep_face(), ELEM, F_EDGE, faces, find_bevvert(), find_edge_half(), EdgeHalf::fnext, EdgeHalf::fprev, BoundVert::index, EdgeHalf::is_seam, l, EdgeHalf::leftv, BevelParams::mat_nr, mesh_vert(), BoundVert::nv, record_face_kind(), EdgeHalf::rightv, EdgeHalf::seg, BevVert::v, NewVert::v, BMEdge::v1, BMEdge::v2, verts, BevVert::vmesh, and weld_cross_attrs_copy().
Referenced by BM_mesh_bevel().
|
static |
Definition at line 5892 of file bmesh_bevel.cc.
References BevVert::any_seam, blender::Vector< T, InlineBufferCapacity, Allocator >::append(), bev_create_ngon(), bm, VMesh::boundstart, boundvert_rep_face(), BMVert::co, blender::Vector< T, InlineBufferCapacity, Allocator >::data(), BoundVert::ebev, ELEM, F_VERT, find_closer_edge(), find_face_internal_boundverts(), frep_for_center_poly(), get_incident_edges(), BoundVert::index, BevelParams::mat_nr, mesh_vert(), BoundVert::next, BoundVert::nv, record_face_kind(), EdgeHalf::seg, BevVert::v, NewVert::v, and BevVert::vmesh.
Referenced by bevel_build_trifan(), and build_vmesh().
|
static |
Given that the boundary is built and the boundary BMVert's have been made, calculate the positions of the interior mesh points for the M_ADJ pattern, using cubic subdivision, then make the BMVert's and the new faces.
Definition at line 5517 of file bmesh_bevel.cc.
References adj_vmesh(), BevelParams::affect_type, BevVert::any_seam, bev_create_ngon(), BEVEL_AFFECT_EDGES, BEVEL_AFFECT_VERTICES, BEVEL_PROFILE_CUSTOM, BLI_array_alloca, BLI_assert, bm, VMesh::boundstart, boundvert_rep_face(), build_center_ngon(), build_square_in_vmesh(), choose_rep_face(), copy_v3_v3(), VMesh::count, create_mesh_bmvert(), e, EdgeHalf::e, BoundVert::ebev, BoundVert::efirst, ELEM, F_VERT, frep_for_center_poly(), i, BoundVert::index, is_canon(), EdgeHalf::is_seam, BevelParams::mat_nr, mesh_vert(), BoundVert::next, pipe_adj_vmesh(), BoundVert::prev, PRO_SQUARE_IN_R, PRO_SQUARE_R, BevelParams::pro_super_r, BevelParams::profile_type, record_face_kind(), VMesh::seg, BevVert::selcount, snap_edges_for_vmesh_vert(), square_out_adj_vmesh(), tri_corner_adj_vmesh(), tri_corner_test(), BevVert::v, NewVert::v, BevVert::vmesh, and vmesh_copy_equiv_verts().
Referenced by build_vmesh().
|
static |
Definition at line 5971 of file bmesh_bevel.cc.
References bevel_build_poly(), BLI_assert, bm, BM_FACE_FIRST_LOOP, BM_face_split(), BMLoop::e, F_VERT, flag_out_edge(), BMFace::len, BMLoop::next, next_bev(), BMLoop::prev, record_face_kind(), BevVert::selcount, and BMLoop::v.
Referenced by build_vmesh().
Try to extend the bv->edges[] array beyond i by finding more successor edges. This is a possibly exponential-time search, but it is only exponential in the number of "internal faces" at a vertex – i.e., faces that bridge between the edges that naturally form a manifold cap around bv. It is rare to have more than one of these, so unlikely that the exponential time case will be hit in practice. Returns the new index i' where bv->edges[i'] ends the best path found. The path will have the tags of all of its edges set.
Definition at line 6237 of file bmesh_bevel.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), bevel_edge_order_extend(), BLI_assert, bm, BM_BEVEL_EDGE_TAG_DISABLE, BM_BEVEL_EDGE_TAG_ENABLE, BM_BEVEL_EDGE_TAG_TEST, BM_ITER_ELEM, BM_LOOPS_OF_EDGE, blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), EdgeHalf::e, BevVert::edgecount, BevVert::edges, edges_face_connected_at_vert(), i, l, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and BevVert::v.
Referenced by bevel_edge_order_extend(), and find_bevel_edge_order().
|
static |
Definition at line 2609 of file bmesh_bevel.cc.
References bm, BM_elem_flag_disable, BM_elem_flag_test, BM_ELEM_SMOOTH, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, ELEM, BMLoop::f, F_EDGE, F_RECON, F_VERT, get_face_kind(), and l.
Referenced by bevel_harden_normals().
|
static |
Definition at line 2596 of file bmesh_bevel.cc.
References bevel_extend_edge_data_ex(), BM_ELEM_SEAM, BM_ELEM_SMOOTH, M_TRI_FAN, VMesh::mesh_kind, BevVert::selcount, and BevVert::vmesh.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 2537 of file bmesh_bevel.cc.
References BLI_assert, BM_DISK_EDGE_NEXT, BM_elem_flag_set, BM_ELEM_SEAM, BM_ELEM_SMOOTH, VMesh::boundstart, VMesh::count, BMVert::e, e, ELEM, flag, i, BoundVert::index, mesh_vert(), BoundVert::next, BoundVert::seam_len, VMesh::seg, BoundVert::sharp_len, NewVert::v, v2, and BevVert::vmesh.
Referenced by bevel_extend_edge_data().
|
static |
Harden normals for bevel.
The desired effect is that the newly created F_EDGE and F_VERT faces appear smoothly shaded with the normals at the boundaries with F_RECON faces matching those recon faces. And at boundaries between F_EDGE and F_VERT faces, the normals should match the F_EDGE ones. Assumes custom loop normals are in use.
Definition at line 2644 of file bmesh_bevel.cc.
References add_v3_v3v3(), bevel_edges_sharp_boundary(), BKE_lnor_space_custom_normal_to_data(), bm, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_LONG_TAG, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_lnorspace_update(), BM_LOOPS_OF_FACE, BM_mesh_normals_update(), BM_vert_step_fan_loop(), CD_PROP_INT16_2D, CustomData_get_offset_named(), BMLoop::e, ELEM, BMLoop::f, F_EDGE, F_NONE, F_ORIG, F_RECON, F_VERT, get_face_kind(), BevelParams::harden_normals, l, BMFace::no, norm(), normalize_v3(), BevelParams::offset, and BMLoop::prev.
Referenced by BM_mesh_bevel().
|
static |
Calculate an offset that is the lesser of the current bp.offset and the maximum possible offset before geometry collisions happen. If the offset changes as a result of this, adjust the current edge offset specs to reflect this clamping, and store the new offset in bp.offset.
Definition at line 7800 of file bmesh_bevel.cc.
References BevelParams::affect_type, BEVEL_AFFECT_VERTICES, bm, BM_elem_flag_test, BM_ELEM_TAG, BM_ITER_MESH, BM_VERTS_OF_MESH, BevVert::edgecount, BevVert::edges, find_bevvert(), geometry_collide_offset(), i, BevelParams::offset, EdgeHalf::offset_l, EdgeHalf::offset_l_spec, EdgeHalf::offset_r, EdgeHalf::offset_r_spec, and vertex_collide_offset().
Referenced by BM_mesh_bevel().
|
static |
Merge UVs based on data gathered in bm->uv_vert_maps. If UV verts are in the same bucket, merge them together. Note that this function exists purely because of imperfections in initial UV position calculations using interpolation approach (BM_loop_interp_from_face function).
Definition at line 808 of file bmesh_bevel.cc.
References add_v2_v2(), BLI_assert, bm, BM_ELEM_CD_GET_FLOAT_P, CD_PROP_FLOAT2, copy_v2_v2(), CustomData_get_n_offset(), CustomData_number_of_layers(), i, l, mul_v2_fl(), and BevelParams::uv_vert_maps.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 6961 of file bmesh_bevel.cc.
References bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), BM_edge_other_vert(), BM_elem_flag_test, BM_ELEM_TAG, VMesh::boundstart, BMVert::co, NewVert::co, e, find_bevvert(), FLT_MAX, i, len_squared_v3v3(), BoundVert::next, BoundVert::nv, NewVert::v, v, BevVert::vmesh, BevVert::wire_edges, and BevVert::wirecount.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 6941 of file bmesh_bevel.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), bev_rebuild_polygon(), bm, BM_FACES_OF_VERT, BM_ITER_ELEM, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), and v.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 2773 of file bmesh_bevel.cc.
References BEVEL_FACE_STRENGTH_AFFECTED, BEVEL_FACE_STRENGTH_ALL, BEVEL_FACE_STRENGTH_NEW, bm, BM_data_layer_add_named(), BM_ELEM_CD_GET_VOID_P, BM_FACES_OF_MESH, BM_ITER_MESH, CD_PROP_INT32, CustomData_get_layer_index(), CustomData_get_n_offset(), CustomData_get_named_layer_index(), F_EDGE, F_ORIG, F_RECON, F_VERT, FACE_STRENGTH_MEDIUM, BevelParams::face_strength_mode, FACE_STRENGTH_STRONG, FACE_STRENGTH_WEAK, get_face_kind(), and MOD_WEIGHTEDNORMALS_FACEWEIGHT_CDLAYER_ID.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 6457 of file bmesh_bevel.cc.
References add_v3_v3v3(), BevelParams::affect_type, angle_v3v3(), bev_ccw_test(), BEVEL_AFFECT_VERTICES, BEVEL_AMT_ABSOLUTE, BEVEL_AMT_DEPTH, BEVEL_AMT_OFFSET, BEVEL_AMT_PERCENT, BEVEL_AMT_WIDTH, BEVEL_EPSILON, BKE_defvert_find_weight(), BLI_assert, BLI_assert_msg, BLI_ghash_insert(), BLI_memarena_alloc(), bm, BM_BEVEL_EDGE_TAG_DISABLE, BM_BEVEL_EDGE_TAG_ENABLE, BM_edge_calc_length(), BM_edge_face_count(), BM_edge_is_wire(), BM_edge_other_vert(), BM_EDGES_OF_VERT, BM_ELEM_CD_GET_FLOAT, BM_elem_flag_disable, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_TAG, BM_ITER_ELEM, BevelParams::bweight_offset_edge, BevelParams::bweight_offset_vert, BMVert::co, contig_ldata_across_edge(), cosf, BevelParams::dvert, e, EdgeHalf::e, edge_face_angle(), BevVert::edgecount, BevVert::edges, ELEM, fabsf, find_bevel_edge_order(), EdgeHalf::fnext, EdgeHalf::fprev, i, BevelParams::mem_arena, normalize_v3(), BevelParams::offset, BevVert::offset, BevelParams::offset_type, BevelParams::seg, VMesh::seg, BevVert::selcount, sinf, sub_v3_v3v3(), BevelParams::use_weights, BevVert::v, v, BMEdge::v2, v2, BevelParams::vert_hash, BevelParams::vertex_group, BevVert::vmesh, BevVert::wire_edges, BevVert::wirecount, and z().
Referenced by BM_mesh_bevel().
|
static |
Definition at line 6029 of file bmesh_bevel.cc.
References BevelParams::affect_type, BEVEL_AFFECT_VERTICES, BLI_assert, bm, BM_CREATE_NO_DOUBLE, BM_edge_create(), BM_vert_face_check(), VMesh::boundstart, BMVert::co, copy_mesh_vert(), copy_v3_v3(), VMesh::count, create_mesh_bmvert(), EdgeHalf::e, BevVert::edges, Profile::end, flag_out_edge(), get_profile_point(), mesh_vert(), Profile::middle, Profile::plane_co, Profile::plane_no, BevelParams::pro_super_r, BoundVert::profile, Profile::proj_dir, VMesh::seg, Profile::start, Profile::super_r, BevVert::v, NewVert::v, v2, BevVert::vmesh, and zero_v3().
Referenced by build_vmesh().
|
static |
Definition at line 7014 of file bmesh_bevel.cc.
References BevVert::edgecount, BevVert::edges, EdgeHalf::is_bev, and BevVert::selcount.
Referenced by bevel_build_edge_polygons().
| void BM_mesh_bevel | ( | BMesh * | bm, |
| float | offset, | ||
| int | offset_type, | ||
| int | profile_type, | ||
| int | segments, | ||
| float | profile, | ||
| bool | affect_type, | ||
| bool | use_weights, | ||
| bool | limit_offset, | ||
| const MDeformVert * | dvert, | ||
| int | vertex_group, | ||
| int | mat, | ||
| bool | loop_slide, | ||
| bool | mark_seam, | ||
| bool | mark_sharp, | ||
| bool | harden_normals, | ||
| int | face_strength_mode, | ||
| int | miter_outer, | ||
| int | miter_inner, | ||
| float | spread, | ||
| const CurveProfile * | custom_profile, | ||
| int | vmesh_method, | ||
| int | bweight_offset_vert, | ||
| int | bweight_offset_edge ) |
Definition at line 7853 of file bmesh_bevel.cc.
References adjust_offsets(), BevelParams::affect_type, BEVEL_AFFECT_VERTICES, BEVEL_AMT_ABSOLUTE, BEVEL_AMT_PERCENT, bevel_build_edge_polygons(), bevel_extend_edge_data(), BEVEL_FACE_STRENGTH_NONE, bevel_harden_normals(), bevel_limit_offset(), bevel_merge_uvs(), BEVEL_MITER_SHARP, BEVEL_PROFILE_CUSTOM, bevel_reattach_wires(), bevel_rebuild_existing_polygons(), bevel_set_weighted_normal_face_strength(), bevel_vert_construct(), BEVEL_VMESH_CUTOFF, BLI_assert, BLI_ghash_flag_set(), BLI_ghash_free(), BLI_ghash_ptr_new(), BLI_memarena_free(), BLI_memarena_new(), BLI_memarena_use_calloc(), BLI_time_now_seconds(), BevelParams::bm, bm, BM_EDGES_OF_MESH, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_LONG_TAG, BM_ELEM_TAG, BM_face_kill(), BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_ITER_MESH_MUTABLE, BM_LOOPS_OF_FACE, BM_vert_kill(), BM_VERTS_OF_MESH, BMO_edge_flag_test, BMO_vert_flag_test, build_boundary(), build_vmesh(), BevelParams::bweight_offset_edge, BevelParams::bweight_offset_vert, BevelParams::custom_profile, determine_uv_vert_connectivity(), BevelParams::dvert, e, EDGE_OUT, ELEM, F_EDGE, fabsf, BevelParams::face_hash, BevelParams::face_strength_mode, find_bevvert(), find_profile_fullness(), ProfileSpacing::fullness, get_face_kind(), GHASH_FLAG_ALLOW_DUPES, BevelParams::harden_normals, l, BevelParams::limit_offset, logf, BevelParams::loop_slide, BevelParams::mark_seam, BevelParams::mark_sharp, BevelParams::mat_nr, math_layer_info_init(), max_ii(), BevelParams::mem_arena, MEM_SIZE_OPTIMAL, BevelParams::miter_inner, BevelParams::miter_outer, BevelParams::offset, BevelParams::offset_adjust, BevelParams::offset_type, printf, PRO_CIRCLE_R, PRO_LINE_R, BevelParams::pro_spacing, BevelParams::pro_spacing_miter, PRO_SQUARE_IN_R, PRO_SQUARE_R, BevelParams::pro_super_r, BevelParams::profile, BevelParams::profile_type, regularize_profile_orientation(), BevelParams::seg, set_profile_spacing(), BevelParams::spread, sqrtf, BevelParams::use_weights, BevelParams::uv_face_hash, uv_vert_map_init(), uv_vert_map_pop(), v, BevelParams::vert_hash, VERT_OUT, BevelParams::vertex_group, and BevelParams::vmesh_method.
Referenced by bmo_bevel_exec(), and modify_mesh().
Return a good representative face (for materials, etc.) for faces created around/near BoundVert v. Sometimes care about a second choice, if there is one. If r_fother parameter is non-nullptr and there is another, different, possible frep, return the other one in that parameter.
Definition at line 843 of file bmesh_bevel.cc.
References v.
Referenced by bevel_build_poly(), bevel_build_rings(), and build_center_ngon().
|
static |
Make a circular list of BoundVerts for bv, each of which has the coordinates of a vertex on the boundary of the beveled vertex bv->v. This may adjust some EdgeHalf widths, and there might have to be a subsequent pass to make the widths as consistent as possible. Doesn't make the actual BMVerts.
For a width consistency pass, we just recalculate the coordinates of the #BoundVerts. If the other ends have been (re)built already, then we copy the offsets from there to match, else we use the ideal (user-specified) widths.
| construct | The first time through, construct will be true and we are making the #BoundVerts and setting up the BoundVert and EdgeHalf pointers appropriately. Also, if construct, decide on the mesh pattern that will be used inside the boundary. |
Definition at line 3153 of file bmesh_bevel.cc.
References add_new_bound_vert(), adjust_bound_vert(), adjust_miter_coords(), adjust_miter_inner_coords(), BevelParams::affect_type, ANGLE_LARGER, ANGLE_SMALLER, BEVEL_AFFECT_VERTICES, BEVEL_MITER_PATCH, BEVEL_MITER_SHARP, BEVEL_VMESH_ADJ, BEVEL_VMESH_CUTOFF, BLI_assert, build_boundary_terminal_edge(), build_boundary_vertex_only(), copy_v3_v3(), VMesh::count, e, BoundVert::ebev, BevVert::edgecount, edges_angle_kind(), BoundVert::efirst, eh_on_plane(), BoundVert::elast, BoundVert::eon, good_offset_on_edge_between(), i, BoundVert::is_arc_start, EdgeHalf::is_bev, BoundVert::is_patch_start, EdgeHalf::leftv, BevelParams::loop_slide, M_ADJ, M_CUTOFF, M_NONE, M_POLY, BevelParams::mark_seam, BevelParams::mark_sharp, BevelParams::mem_arena, mem_arena, VMesh::mesh_kind, Profile::middle, BevelParams::miter_inner, BevelParams::miter_outer, BoundVert::next, EdgeHalf::next, next_bev(), offset_meet(), offset_on_edge_between(), BoundVert::profile, BevelParams::seg, EdgeHalf::seg, BevVert::selcount, set_bound_vert_seams(), BoundVert::sinratio, BevVert::v, v, v2, BevVert::vmesh, and BevelParams::vmesh_method.
Referenced by adjust_offsets(), and BM_mesh_bevel().
|
static |
Special case of build_boundary when a single edge is beveled. The 'width adjust' part of build_boundary has been done already, and efirst is the first beveled edge at vertex bv.
Definition at line 2923 of file bmesh_bevel.cc.
References add_new_bound_vert(), adjust_bound_vert(), BEVEL_AMT_ABSOLUTE, BEVEL_AMT_PERCENT, BEVEL_EPSILON_BIG, BEVEL_PROFILE_CUSTOM, BLI_assert, VMesh::boundstart, NewVert::co, VMesh::count, dist_squared_to_plane_v3(), e, BoundVert::ebev, BevVert::edgecount, BoundVert::efirst, BoundVert::elast, EdgeHalf::leftv, M_NONE, M_POLY, M_TRI_FAN, BevelParams::mark_seam, BevelParams::mark_sharp, BevelParams::mem_arena, mem_arena, VMesh::mesh_kind, move_profile_plane(), BoundVert::next, BoundVert::nv, offset_in_plane(), EdgeHalf::offset_l_spec, offset_meet(), BevelParams::offset_type, Profile::plane_co, plane_from_point_normal_v3(), Profile::plane_no, BevelParams::profile, BoundVert::profile, BevelParams::profile_type, EdgeHalf::rightv, set_bound_vert_seams(), set_profile_params(), slide_dist(), sqrtf, BevVert::v, and BevVert::vmesh.
Referenced by build_boundary().
|
static |
Definition at line 2883 of file bmesh_bevel.cc.
References add_new_bound_vert(), adjust_bound_vert(), BevelParams::affect_type, BEVEL_AFFECT_VERTICES, BLI_assert, VMesh::count, e, BevVert::edges, M_ADJ, M_NONE, M_POLY, BevelParams::mark_seam, BevelParams::mark_sharp, BevelParams::mem_arena, VMesh::mesh_kind, BevelParams::seg, set_bound_vert_seams(), slide_dist(), BevVert::v, v, and BevVert::vmesh.
Referenced by build_boundary().
|
static |
Definition at line 5078 of file bmesh_bevel.cc.
References BevVert::any_seam, blender::Vector< T, InlineBufferCapacity, Allocator >::append(), bev_create_ngon(), bm, VMesh::boundstart, boundvert_rep_face(), blender::Vector< T, InlineBufferCapacity, Allocator >::data(), ELEM, F_VERT, find_closer_edge(), find_face_internal_boundverts(), frep_for_center_poly(), get_incident_edges(), i, mesh_vert(), record_face_kind(), VMesh::seg, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), BevVert::v, v, and BevVert::vmesh.
Referenced by bevel_build_rings(), and build_square_in_vmesh().
|
static |
Special case of bevel_build_rings when triangle-corner and profile is 0. There is no corner mesh except, if nseg odd, for a center poly. Boundary verts merge with previous ones according to pattern: (i, 0, k) merged with (i+1, 0, ns-k) for k <= ns/2.
Definition at line 5128 of file bmesh_bevel.cc.
References bm, build_center_ngon(), copy_v3_v3(), VMesh::count, create_mesh_bmvert(), i, BevelParams::mat_nr, mesh_vert(), VMesh::seg, BevVert::v, NewVert::v, and BevVert::vmesh.
Referenced by bevel_build_rings().
|
static |
Definition at line 6081 of file bmesh_bevel.cc.
References BevelParams::affect_type, BEVEL_AFFECT_VERTICES, bevel_build_cutoff(), bevel_build_poly(), bevel_build_rings(), bevel_build_trifan(), BEVEL_PROFILE_CUSTOM, bevel_vert_two_edges(), BLI_memarena_alloc(), bm, VMesh::boundstart, calculate_vm_profiles(), NewVert::co, copy_mesh_vert(), copy_v3_v3(), VMesh::count, create_mesh_bmvert(), BoundVert::ebev, ELEM, get_profile_point(), i, BoundVert::index, M_ADJ, M_CUTOFF, M_NONE, M_POLY, M_TRI_FAN, BevelParams::mem_arena, VMesh::mesh, VMesh::mesh_kind, mesh_vert(), mid_v3_v3v3(), move_weld_profile_planes(), BoundVert::next, BoundVert::nv, pipe_test(), PRO_LINE_R, BoundVert::profile, BevelParams::profile_type, BevelParams::seg, VMesh::seg, BevVert::selcount, set_profile_params(), Profile::super_r, BevVert::v, NewVert::v, and BevVert::vmesh.
Referenced by BM_mesh_bevel().
|
static |
Calculate the actual coordinate values for bndv's profile. This is only needed if bp->seg > 1. Allocate the space for them if that hasn't been done already. If bp->seg is not a power of 2, also need to calculate the coordinate values for the power of 2 >= bp->seg, because the ADJ pattern needs power-of-2 boundaries during construction.
Definition at line 2337 of file bmesh_bevel.cc.
References BEVEL_PROFILE_SUPERELLIPSE, BEVEL_VMESH_CUTOFF, BLI_memarena_alloc(), calculate_profile_segments(), Profile::end, Profile::height, len_v3v3(), make_unit_square_map(), BevelParams::mem_arena, Profile::middle, mul_v3_m4v3(), PRO_LINE_R, BevelParams::pro_spacing, BevelParams::pro_spacing_miter, Profile::prof_co, Profile::prof_co_2, BoundVert::profile, BevelParams::profile_type, BevelParams::seg, ProfileSpacing::seg_2, Profile::start, Profile::super_r, BevelParams::vmesh_method, ProfileSpacing::xvals, ProfileSpacing::xvals_2, ProfileSpacing::yvals, and ProfileSpacing::yvals_2.
Referenced by calculate_vm_profiles(), and make_cube_corner_adj_vmesh().
|
static |
Helper for calculate_profile that builds the 3D locations for the segments and the higher power of 2 segments.
Definition at line 2280 of file bmesh_bevel.cc.
References add_v3_v3v3(), copy_v3_v3(), Profile::end, float, interp_v3_v3v3(), is_zero_v3(), isect_line_plane_v3(), mul_v3_m4v3(), Profile::plane_co, Profile::plane_no, Profile::proj_dir, and Profile::start.
Referenced by calculate_profile().
|
static |
Calculate the profiles for all the BoundVerts of VMesh vm.
Definition at line 2862 of file bmesh_bevel.cc.
References BEVEL_PROFILE_CUSTOM, VMesh::boundstart, calculate_profile(), BoundVert::is_arc_start, BoundVert::is_patch_start, BoundVert::is_profile_start, BoundVert::next, BoundVert::profile, BevelParams::profile_type, set_profile_params(), and Profile::special_params.
Referenced by build_vmesh().
|
static |
Definition at line 2489 of file bmesh_bevel.cc.
References BM_ELEM_SEAM, BM_ELEM_SMOOTH, e, BevVert::edges, flag, HASNOT_SEAMSHARP, EdgeHalf::is_bev, and EdgeHalf::next.
Referenced by set_bound_vert_seams().
|
static |
Use a tie-breaking rule to choose a representative face when there are number of choices, face[0], face[1], ..., face[nfaces]. This is needed when there are an odd number of segments, and the center segment (and its continuation into vmesh) can usually arbitrarily be the previous face or the next face. Or, for the center polygon of a corner, all of the faces around the vertex are possibleface_component choices. If we just choose randomly, the resulting UV maps or material assignment can look ugly/inconsistent. Allow for the case when arguments are null.
Definition at line 1211 of file bmesh_bevel.cc.
References BLI_array_alloca, BLI_assert, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_SELECT, BM_face_calc_center_bounds(), MathLayerInfo::face_component, float, i, BMFace::mat_nr, BevelParams::math_layer_info, and VEC_VALUE_LEN.
Referenced by bevel_build_edge_polygons(), bevel_build_rings(), and frep_for_center_poly().
Copy whichever of a and b is closer to v into r.
Definition at line 5161 of file bmesh_bevel.cc.
References b, copy_v3_v3(), len_squared_v3v3(), and v.
Referenced by square_out_adj_vmesh().
Definition at line 992 of file bmesh_bevel.cc.
References BLI_assert, bm, BM_edge_loop_pair(), contig_ldata_across_loops(), CustomData_layer_has_math(), e, BMLoop::f, i, BMLoop::next, UNUSED_VARS_NDEBUG, BMLoop::v, and v2.
Referenced by bevel_vert_construct(), and math_layer_info_init().
Definition at line 980 of file bmesh_bevel.cc.
References bm, CustomData_data_equals(), BMHeader::data, and BMLoop::head.
Referenced by contig_ldata_across_edge().
|
static |
Definition at line 541 of file bmesh_bevel.cc.
References NewVert::co, copy_v3_v3(), mesh_vert(), and NewVert::v.
Referenced by bevel_vert_two_edges(), and build_vmesh().
Definition at line 611 of file bmesh_bevel.cc.
Referenced by bev_rebuild_polygon().
Definition at line 533 of file bmesh_bevel.cc.
References bm, BM_CREATE_NOP, BM_elem_flag_disable, BM_ELEM_TAG, BM_vert_create(), NewVert::co, flag_out_vert(), i, mesh_vert(), and NewVert::v.
Referenced by bevel_build_cutoff(), bevel_build_rings(), bevel_vert_two_edges(), build_square_in_vmesh(), and build_vmesh().
|
static |
Definition at line 4296 of file bmesh_bevel.cc.
References add_v3_v3(), add_v3_v3v3(), avg4(), beta(), BEVEL_PROFILE_CUSTOM, BLI_assert, VMesh::boundstart, copy_v3_v3(), VMesh::count, get_profile_point(), i, madd_v3_v3fl(), BevelParams::mem_arena, mesh_vert(), mesh_vert_canon(), mul_v3_fl(), new_adj_vmesh(), BoundVert::next, BoundVert::profile, BevelParams::profile_type, sabin_gamma(), VMesh::seg, vmesh_copy_equiv_verts(), and zero_v3().
Referenced by adj_vmesh(), and make_cube_corner_adj_vmesh().
|
static |
Determine UV vert connectivity based on provided BMVert *v. If UV loop data is available, iterate through loops of vertex v, fetching UV position for each loop and checking against already evaluated ones. If UV coords are overlapping (delta smaller than STD_UV_CONNECT_LIMIT) then add those loops to the same UV vert bucket. If UV verts are not overlapping they will end up in separate buckets. Those buckets are later utilized during UV merging process, i.e. UV verts which will end up in the same bucket will be merged together.
Definition at line 764 of file bmesh_bevel.cc.
References BLI_assert, bm, BM_ELEM_CD_GET_FLOAT_P, BM_ITER_ELEM, BM_LOOPS_OF_VERT, CD_PROP_FLOAT2, compare_v2v2(), CustomData_get_n_offset(), CustomData_number_of_layers(), i, l, STD_UV_CONNECT_LIMIT, BevelParams::uv_vert_maps, and v.
Referenced by BM_mesh_bevel().
Definition at line 443 of file bmesh_bevel.cc.
References bm, BMO_edge_flag_disable, and EDGE_OUT.
Referenced by bev_rebuild_polygon().
|
static |
Definition at line 1385 of file bmesh_bevel.cc.
References BLI_assert, BMVert::co, cross, cross_v3_v3v3(), dot_v3v3(), BMFace::no, sub_v3_v3v3(), v, BMEdge::v1, BMEdge::v2, and v2.
Referenced by offset_meet_lines_percent_or_absolute().
Definition at line 6214 of file bmesh_bevel.cc.
References angle_normalized_v3v3(), e, float, and M_PI.
Referenced by bevel_vert_construct().
Definition at line 1318 of file bmesh_bevel.cc.
References ANGLE_LARGER, ANGLE_SMALLER, ANGLE_STRAIGHT, BM_edge_other_vert(), BMVert::co, cross, cross_v3_v3v3(), dot_v3v3(), EdgeHalf::e, EdgeHalf::fnext, EdgeHalf::fprev, nearly_parallel_normalized(), BMFace::no, normalize_v3(), sub_v3_v3v3(), v, and v2.
Referenced by build_boundary(), and square_out_adj_vmesh().
Definition at line 629 of file bmesh_bevel.cc.
References BM_ITER_ELEM, BM_LOOPS_OF_EDGE, and l.
Referenced by bevel_edge_order_extend().
|
static |
Definition at line 2845 of file bmesh_bevel.cc.
References BEVEL_EPSILON_BIG, dot(), dot_v3v3(), e, and fabsf.
Referenced by build_boundary().
|
static |
Definition at line 6337 of file bmesh_bevel.cc.
References BM_BEVEL_EDGE_TAG_DISABLE, BM_BEVEL_EDGE_TAG_ENABLE, BM_BEVEL_EDGE_TAG_TEST, BM_EDGES_OF_VERT, BM_face_edge_share_loop(), BM_FACES_OF_EDGE, BM_ITER_ELEM, e, EdgeHalf::e, BevVert::edgecount, BevVert::edges, i, BMEdge::l, and BevVert::v.
Referenced by find_bevel_edge_order().
|
static |
Definition at line 4172 of file bmesh_bevel.cc.
References NewVert::co, copy_v3_v3(), frac(), get_profile_point(), len_v3v3(), BoundVert::nv, and BoundVert::profile.
Referenced by interp_vmesh().
Definition at line 4151 of file bmesh_bevel.cc.
References frac(), i, len_v3v3(), mesh_vert(), and VMesh::seg.
Referenced by interp_vmesh().
Definition at line 6394 of file bmesh_bevel.cc.
References bevel_edge_order_extend(), BLI_assert, bm, BM_BEVEL_EDGE_TAG_ENABLE, BM_BEVEL_EDGE_TAG_TEST, BM_edge_face_count(), BM_EDGES_OF_VERT, BM_ITER_ELEM, BM_LOOPS_OF_EDGE, e, EdgeHalf::e, BevVert::edgecount, BevVert::edges, fast_bevel_edge_order(), EdgeHalf::fprev, i, l, and BevVert::v.
Referenced by bevel_vert_construct().
|
static |
Definition at line 561 of file bmesh_bevel.cc.
References BLI_ghash_lookup(), and BevelParams::vert_hash.
Referenced by adjust_offsets(), bev_rebuild_polygon(), bevel_build_edge_polygons(), bevel_limit_offset(), bevel_reattach_wires(), BM_mesh_bevel(), find_other_end_edge_half(), and regularize_profile_orientation().
Definition at line 4913 of file bmesh_bevel.cc.
References BLI_assert, BMVert::co, dist_squared_to_line_segment_v3(), BMEdge::v1, and BMEdge::v2.
Referenced by bevel_build_poly(), and build_center_ngon().
Definition at line 550 of file bmesh_bevel.cc.
References EdgeHalf::e, BevVert::edgecount, BevVert::edges, and i.
Referenced by bev_rebuild_polygon(), bevel_build_edge_polygons(), find_other_end_edge_half(), and regularize_profile_orientation().
|
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 7403 of file bmesh_bevel.cc.
References cos, find_even_superellipse_chords_general(), i, M_PI_2, M_SQRT2, PRO_CIRCLE_R, PRO_LINE_R, PRO_SQUARE_IN_R, PRO_SQUARE_R, and sin.
Referenced by 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 7307 of file bmesh_bevel.cc.
References e, find_superellipse_chord_endpoint(), i, M_SQRT2, pow, sqrt, sum(), and superellipse_co().
Referenced by find_even_superellipse_chords().
|
static |
Find which BoundVerts of bv are internal to face f. That is, when both the face and the point are projected to 2d, the point is on the boundary of or inside the projected face. There can only be up to three of then, since, including miters, that is the maximum number of BoundVerts that can be between two edges. Return the number of face-internal vertices found.
Definition at line 4932 of file bmesh_bevel.cc.
References BLI_assert, BM_face_point_inside_test(), VMesh::boundstart, i, v, and BevVert::vmesh.
Referenced by bevel_build_poly(), build_center_ngon(), and projected_boundary_area().
|
static |
Find the EdgeHalf representing the other end of e->e.
Definition at line 577 of file bmesh_bevel.cc.
References BLI_assert, e, find_bevvert(), and find_edge_half().
Referenced by adjust_offsets(), geometry_collide_offset(), next_edgehalf_bev(), and vertex_collide_offset().
|
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 7479 of file bmesh_bevel.cc.
References BEVEL_PROFILE_CUSTOM, CIRCLE_FULLNESS_SEGS, float, i, PRO_CIRCLE_R, PRO_LINE_R, BevelParams::pro_spacing, BevelParams::pro_super_r, BevelParams::profile, BevelParams::profile_type, BevelParams::seg, ProfileSpacing::xvals, and ProfileSpacing::yvals.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 7243 of file bmesh_bevel.cc.
References e, fabs(), M_SQRT2, pow, sqrt, and superellipse_co().
Referenced by find_even_superellipse_chords_general().
|
static |
Definition at line 567 of file bmesh_bevel.cc.
References BLI_ghash_lookup(), and BevelParams::uv_face_hash.
Referenced by update_uv_vert_map().
Definition at line 429 of file bmesh_bevel.cc.
References bm, BMO_edge_flag_enable, and EDGE_OUT.
Referenced by bev_create_ngon(), bevel_build_trifan(), and bevel_vert_two_edges().
Definition at line 436 of file bmesh_bevel.cc.
References bm, BMO_vert_flag_enable, and VERT_OUT.
Referenced by create_mesh_bmvert().
|
static |
Pick a good face from all the faces around bv to use for a representative face, using choose_rep_face. We want to choose from among the faces that would be chosen for a single-segment edge polygon between two successive Boundverts. But the single beveled edge is a special case, where we also want to consider the third face (else can get zero-area UV interpolated face).
If there are math-having custom loop layers, like UV, then don't include faces that would result in zero-area UV polygons if chosen as the rep.
Definition at line 5034 of file bmesh_bevel.cc.
References BLI_array_alloca, choose_rep_face(), BevVert::edgecount, BevVert::edges, EdgeHalf::fnext, EdgeHalf::fprev, MathLayerInfo::has_math_layers, i, is_bad_uv_poly(), EdgeHalf::is_bev, BevelParams::math_layer_info, and BevVert::selcount.
Referenced by bevel_build_poly(), bevel_build_rings(), and build_center_ngon().
|
static |
Assume we have a situation like:
a d
\ /
A \ / C
\ th1 th2/
b---------c
B
where edges are A, B, and C, following a face around vertices a, b, c, d. th1 is angle abc and th2 is angle bcd; and the argument EdgeHalf eb is B, going from b to c. In general case, edge offset specs for A, B, C have the form ka*t, kb*t, kc*t where ka, kb, kc are some factors (may be 0) and t is the current bp->offset. We want to calculate t at which the clone of B parallel to it collapses. This can be calculated using trig. Another case of geometry collision that can happen is When B slides along A because A is un-beveled. Then it might collide with a. Similarly for B sliding along C.
Definition at line 7626 of file bmesh_bevel.cc.
References angle_v3v3v3(), BEVEL_AMT_ABSOLUTE, BEVEL_AMT_PERCENT, BEVEL_EPSILON, BM_edge_calc_length(), BM_face_edge_share_loop(), BMVert::co, cosf, BMLoop::e, EdgeHalf::e, ELEM, find_other_end_edge_half(), float, EdgeHalf::fnext, EdgeHalf::is_bev, EdgeHalf::is_rev, len_v3v3(), M_PI, BMLoop::next, EdgeHalf::next, BevelParams::offset, EdgeHalf::offset_l_spec, EdgeHalf::offset_r_spec, BevelParams::offset_type, BMLoop::prev, EdgeHalf::prev, safe_divide(), sinf, BevVert::v, BMLoop::v, BMEdge::v1, and BMEdge::v2.
Referenced by bevel_limit_offset().
|
static |
Definition at line 457 of file bmesh_bevel.cc.
References BLI_ghash_lookup(), F_ORIG, BevelParams::face_hash, and POINTER_AS_INT.
Referenced by bevel_edges_sharp_boundary(), bevel_harden_normals(), bevel_set_weighted_normal_face_strength(), and BM_mesh_bevel().
Definition at line 4891 of file bmesh_bevel.cc.
References BM_EDGES_OF_FACE, BM_ITER_ELEM, e, and v.
Referenced by bevel_build_poly(), build_center_ngon(), and projected_boundary_area().
|
static |
Find the point on given profile at parameter i which goes from 0 to nseg as the profile moves from pro->start to pro->end. We assume that nseg is either the global seg number or a power of 2 less than or equal to the power of 2 >= seg. In the latter case, we subsample the profile for seg_2, which will not necessarily give equal spaced chords, but is in fact more what is desired by the cubic subdivision method used to make the vmesh pattern.
Definition at line 2251 of file bmesh_bevel.cc.
References BLI_assert, copy_v3_v3(), Profile::end, i, is_power_of_2_i(), BevelParams::pro_spacing, Profile::prof_co, Profile::prof_co_2, BevelParams::seg, ProfileSpacing::seg_2, and Profile::start.
Referenced by adj_vmesh(), bevel_vert_two_edges(), build_vmesh(), cubic_subdiv(), fill_profile_fracs(), and make_cube_corner_adj_vmesh().
|
static |
Return true if it will look good to put the meeting point where offset_on_edge_between would put it. This means that neither side sees a reflex angle.
Definition at line 1772 of file bmesh_bevel.cc.
References offset_meet_edge(), and v.
Referenced by build_boundary().
Definition at line 4197 of file bmesh_bevel.cc.
Referenced by interp_vmesh().
|
static |
Definition at line 4224 of file bmesh_bevel.cc.
References BEVEL_EPSILON, BLI_array_alloca, VMesh::boundstart, copy_v3_v3(), VMesh::count, fill_profile_fracs(), fill_vmesh_fracs(), frac(), i, interp_bilinear_quad_v3(), interp_range(), BevelParams::mem_arena, mesh_vert(), mesh_vert_canon(), new_adj_vmesh(), BoundVert::next, BoundVert::prev, quad, VMesh::seg, vmesh_center(), and vmesh_copy_equiv_verts().
Referenced by adj_vmesh(), and make_cube_corner_adj_vmesh().
If we make a poly out of verts around bv, snapping to rep frep, will uv poly have zero area? The uv poly is made by snapping all outside-of-frep vertices to the closest edge in frep. Sometimes this results in a zero or very small area polygon, which translates to a zero or very small area polygon in UV space – not good for interpolating textures.
Definition at line 5013 of file bmesh_bevel.cc.
References BEVEL_EPSILON_BIG, BLI_assert, projected_boundary_area(), and BevVert::vmesh.
Referenced by frep_for_center_poly().
|
static |
Definition at line 4062 of file bmesh_bevel.cc.
References i, and VMesh::seg.
Referenced by bevel_build_rings(), make_cube_corner_square(), pipe_adj_vmesh(), and vmesh_copy_equiv_verts().
Definition at line 1297 of file bmesh_bevel.cc.
References BEVEL_EPSILON_BIG, dot_v3v3(), e, normalize_v3(), and sub_v3_v3v3().
Referenced by offset_meet().
|
static |
Make a VMesh with nseg segments that covers the unit radius sphere octant with center at (0,0,0). This has BoundVerts at (1,0,0), (0,1,0) and (0,0,1), with quarter circle arcs on the faces for the orthogonal planes through the origin.
Definition at line 4550 of file bmesh_bevel.cc.
References add_new_bound_vert(), BEVEL_PROFILE_CUSTOM, VMesh::boundstart, calculate_profile(), NewVert::co, copy_v3_fl(), copy_v3_v3(), VMesh::count, cross_v3_v3v3(), cubic_subdiv(), Profile::end, get_profile_point(), i, interp_vmesh(), M_SQRT1_3, make_cube_corner_square(), make_cube_corner_square_in(), BevelParams::mem_arena, mem_arena, mesh_vert(), Profile::middle, mul_v3_fl(), new_adj_vmesh(), BoundVert::next, BoundVert::nv, Profile::plane_co, Profile::plane_no, PRO_SQUARE_IN_R, PRO_SQUARE_R, BevelParams::pro_super_r, BoundVert::profile, BevelParams::profile_type, Profile::proj_dir, BevelParams::seg, VMesh::seg, snap_to_superellipsoid(), Profile::start, Profile::super_r, and vmesh_copy_equiv_verts().
Referenced by tri_corner_adj_vmesh().
Definition at line 4475 of file bmesh_bevel.cc.
References add_new_bound_vert(), copy_v3_v3(), VMesh::count, float, i, is_canon(), mem_arena, mesh_vert(), new_adj_vmesh(), and vmesh_copy_equiv_verts().
Referenced by make_cube_corner_adj_vmesh().
Special case for cube corner, when r is PRO_SQUARE_IN_R, meaning inward straight sides. We mostly don't want a VMesh at all for this case – just a three-way weld with a triangle in the middle for odd nseg.
Definition at line 4509 of file bmesh_bevel.cc.
References add_new_bound_vert(), b, copy_v3_v3(), VMesh::count, float, i, M_SQRT2, mem_arena, mesh_vert(), and new_adj_vmesh().
Referenced by make_cube_corner_adj_vmesh().
|
static |
Like make_unit_square_map, but this one makes a matrix that transforms the (1,1,1) corner of a unit cube into an arbitrary corner with corner vert d and verts around it a, b, c (in CCW order, viewed from d normal dir). The matrix mat is calculated to map: (1,0,0) -> va (0,1,0) -> vb (0,0,1) -> vc (1,1,1) -> vd We want M to make M*A=B where A has the left side above, as columns and B has the right side as columns - both extended into homogeneous coords. So M = B*(Ainverse). Doing Ainverse by hand gives the code below. The cols of M are 1/2{va-vb+vc-vd}, 1/2{-va+vb-vc+vd}, 1/2{-va-vb+vc+vd}, and 1/2{va+vb+vc-vd} and Blender matrices have cols at m[i][*].
Definition at line 2195 of file bmesh_bevel.cc.
References add_v3_v3(), copy_v3_v3(), mul_v3_fl(), and sub_v3_v3().
Referenced by tri_corner_adj_vmesh().
|
static |
Fill matrix r_mat so that a point in the sheared parallelogram with corners va, vmid, vb (and the 4th that is implied by it being a parallelogram) is the result of transforming the unit square by multiplication with r_mat. If it can't be done because the parallelogram is degenerate, return false, else return true. Method: Find vo, the origin of the parallelogram with other three points va, vmid, vb. Also find vd, which is in direction normal to parallelogram and 1 unit away from the origin. The quarter circle in first quadrant of unit square will be mapped to the quadrant of a sheared ellipse in the parallelogram, using a matrix. The matrix mat is calculated to map: (0,1,0) -> va (1,1,0) -> vmid (1,0,0) -> vb (0,1,1) -> vd We want M to make M*A=B where A has the left side above, as columns and B has the right side as columns - both extended into homogeneous coords. So M = B*(Ainverse). Doing Ainverse by hand gives the code below.
Definition at line 2138 of file bmesh_bevel.cc.
References add_v3_v3v3(), angle_v3v3(), BEVEL_EPSILON_ANG, cross_v3_v3v3(), fabsf, is_zero_v3(), M_PI, normalize_v3(), sub_v3_v3(), and sub_v3_v3v3().
Referenced by calculate_profile(), and snap_to_pipe_profile().
|
static |
Definition at line 1081 of file bmesh_bevel.cc.
References BLI_assert, BLI_memarena_alloc(), bm, BM_EDGES_OF_FACE, BM_elem_index_get, BM_FACE, BM_face_at_index(), BM_face_calc_center_bounds(), BM_FACES_OF_EDGE, BM_ITER_ELEM, BM_mesh_elem_index_ensure(), BM_mesh_elem_table_ensure(), CD_PROP_FLOAT2, contig_ldata_across_edge(), CustomData_has_layer(), MathLayerInfo::face_component, MathLayerInfo::has_math_layers, i, BevelParams::math_layer_info, BevelParams::mem_arena, MEM_freeN(), MEM_malloc_arrayN(), BevelParams::seg, swap_face_components(), and UNUSED_VARS_NDEBUG.
Referenced by BM_mesh_bevel().
Definition at line 525 of file bmesh_bevel.cc.
References i, VMesh::mesh, and VMesh::seg.
Referenced by adj_vmesh(), bev_rebuild_polygon(), bevel_build_cutoff(), bevel_build_edge_polygons(), bevel_build_poly(), bevel_build_rings(), bevel_extend_edge_data_ex(), bevel_vert_two_edges(), build_center_ngon(), build_square_in_vmesh(), build_vmesh(), copy_mesh_vert(), create_mesh_bmvert(), cubic_subdiv(), fill_vmesh_fracs(), interp_vmesh(), make_cube_corner_adj_vmesh(), make_cube_corner_square(), make_cube_corner_square_in(), mesh_vert_canon(), pipe_adj_vmesh(), square_out_adj_vmesh(), blender::io::alembic::AbcMeshReader::topology_changed(), tri_corner_adj_vmesh(), vmesh_center(), vmesh_copy_equiv_verts(), and weld_cross_attrs_copy().
VMesh verts for vertex i have data for (i, 0 <= j <= ns2, 0 <= k <= ns), where ns2 = floor(nseg / 2). But these overlap data from previous and next i: there are some forced equivalences. Let's call these indices the canonical ones: we will just calculate data for these 0 <= j <= ns2, 0 <= k <= ns2 (for odd ns) 0 <= j < ns2, 0 <= k <= ns2 (for even ns) also (j=ns2, k=ns2) at i=0 (for even ns2) This function returns the canonical one for any i, j, k in [0,n],[0,ns],[0,ns].
Definition at line 4042 of file bmesh_bevel.cc.
References BLI_assert, VMesh::count, i, mesh_vert(), and VMesh::seg.
Referenced by cubic_subdiv(), interp_vmesh(), and vmesh_copy_equiv_verts().
Maybe move the profile plane for bndv->ebev to the plane its profile's start, and the original beveled vert, bmv. This will usually be the plane containing its adjacent non-beveled edges, but sometimes the start and the end are not on those edges.
Currently just used in build_boundary_terminal_edge.
Definition at line 2027 of file bmesh_bevel.cc.
References BEVEL_EPSILON_BIG, BMVert::co, copy_v3_v3(), cross_v3_v3v3(), dot3(), dot_v3v3(), Profile::end, fabsf, is_zero_v3(), normalize_v3(), Profile::plane_no, BoundVert::profile, Profile::proj_dir, Profile::special_params, Profile::start, and sub_v3_v3v3().
Referenced by build_boundary_terminal_edge().
Move the profile plane for the two BoundVerts involved in a weld. We want the plane that is most likely to have the intersections of the two edges' profile projections on it. bndv1 and bndv2 are by construction the intersection points of the outside parts of the profiles. The original vertex should form a third point of the desired plane.
Definition at line 2067 of file bmesh_bevel.cc.
References BEVEL_EPSILON, BMVert::co, NewVert::co, copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), fabsf, is_zero_v3(), normalize_v3(), BoundVert::nv, Profile::plane_no, BoundVert::profile, Profile::proj_dir, Profile::special_params, sub_v3_v3v3(), and BevVert::v.
Referenced by build_vmesh().
Definition at line 464 of file bmesh_bevel.cc.
References angle_v3v3(), BEVEL_EPSILON_ANG, fabsf, and M_PI.
Referenced by set_profile_params().
Definition at line 474 of file bmesh_bevel.cc.
References BEVEL_EPSILON_ANG_DOT, BLI_ASSERT_UNIT_V3, compare_ff(), dot_v3v3(), and fabsf.
Referenced by edges_angle_kind().
Definition at line 4020 of file bmesh_bevel.cc.
References BLI_memarena_alloc(), bounds(), VMesh::boundstart, count, VMesh::count, M_ADJ, mem_arena, VMesh::mesh, VMesh::mesh_kind, and VMesh::seg.
Referenced by adj_vmesh(), cubic_subdiv(), interp_vmesh(), make_cube_corner_adj_vmesh(), make_cube_corner_square(), make_cube_corner_square_in(), and square_out_adj_vmesh().
Definition at line 596 of file bmesh_bevel.cc.
References e, BevVert::edgecount, and BevVert::edges.
Referenced by bevel_build_trifan(), and build_boundary().
|
static |
Helper function to return the next Beveled EdgeHalf along a path.
| toward_bv | Whether the direction to travel points toward or away from the BevVert connected to the current EdgeHalf. |
| r_bv | The BevVert connected to the EdgeHalf – updated if we're traveling to the other EdgeHalf of an original edge. |
Definition at line 3574 of file bmesh_bevel.cc.
References BEVEL_SMALL_ANG_DOT, BMVert::co, compare_ff(), dot_v3v3(), EdgeHalf::e, find_other_end_edge_half(), EdgeHalf::is_bev, EdgeHalf::next, normalize_v3(), sub_v3_v3v3(), BMEdge::v1, and BMEdge::v2.
Referenced by regularize_profile_orientation().
Definition at line 1852 of file bmesh_bevel.cc.
References BM_edge_other_vert(), BMVert::co, copy_v3_v3(), cross_v3_v3v3(), e, fabsf, left, madd_v3_v3fl(), normalize_v3(), sub_v3_v3v3(), v, and zero_v3().
Referenced by build_boundary_terminal_edge().
|
static |
Calculate the meeting point between the offset edges for e1 and e2, putting answer in meetco. e1 and e2 share vertex v and face f (may be nullptr) and viewed from the normal side of the bevel vertex, e1 precedes e2 in CCW order. Offset edge is on right of both edges, where e1 enters v and e2 leave it. When offsets are equal, the new point is on the edge bisector, with length offset/sin(angle/2), but if the offsets are not equal (we allow for because the bevel modifier has edge weights that may lead to different offsets) then the meeting point can be found by intersecting offset lines. If making the meeting point significantly changes the left or right offset from the user spec, record the change in offset_l (or offset_r); later we can tell that a change has happened because the offset will differ from its original value in offset_l_spec (or offset_r_spec).
| edges_between | If this is true, there are edges between e1 and e2 in CCW order so they don't share a common face. We want the meeting point to be on an existing face so it should be dropped onto one of the intermediate faces, if possible. |
| e_in_plane | If we need to drop from the calculated offset lines to one of the faces, we don't want to drop onto the 'in plane' face, so if this is not null skip this edge's faces. |
Definition at line 1521 of file bmesh_bevel.cc.
References add_v3_v3(), add_v3_v3v3(), angle_v3v3(), BEVEL_AMT_ABSOLUTE, BEVEL_AMT_PERCENT, BEVEL_EPSILON_ANG, BEVEL_SMALL_ANG, BM_edge_other_vert(), closest_to_plane_normalized_v3(), BMVert::co, copy_v3_v3(), cosf, cross_v3_v3v3(), dot_v3v3(), e, EdgeHalf::e, ELEM, fabsf, EdgeHalf::fnext, EdgeHalf::fprev, is_outside_edge(), isect_line_line_v3(), M_PI, madd_v3_v3fl(), max_ff(), mid_v3_v3v3(), mul_v3_fl(), negate_v3(), EdgeHalf::next, BMFace::no, normalize_v3(), EdgeHalf::offset_l, offset_meet_lines_percent_or_absolute(), EdgeHalf::offset_r, BevelParams::offset_type, plane_from_point_normal_v3(), point_between_edges(), EdgeHalf::prev, slide_dist(), sub_v3_v3v3(), v, and zero_v3().
Referenced by build_boundary(), and build_boundary_terminal_edge().
|
static |
Calculate the meeting point between e1 and e2 (one of which should have zero offsets), where e1 precedes e2 in CCW order around their common vertex v (viewed from normal side). If r_angle is provided, return the angle between e and meetco in *r_angle. If the angle is 0, or it is 180 degrees or larger, there will be no meeting point; return false in that case, else true.
Definition at line 1722 of file bmesh_bevel.cc.
References angle_normalized_v3v3(), BEVEL_GOOD_ANGLE, BM_edge_other_vert(), BMVert::co, copy_v3_v3(), cross_v3_v3v3(), dot_v3v3(), EdgeHalf::e, fabsf, float, M_PI, madd_v3_v3fl(), normalize_v3(), EdgeHalf::offset_l, EdgeHalf::offset_r, sinf, sub_v3_v3v3(), and v.
Referenced by good_offset_on_edge_between(), and offset_on_edge_between().
|
static |
Definition at line 1424 of file bmesh_bevel.cc.
References BEVEL_AMT_ABSOLUTE, BM_edge_calc_length(), BM_edge_other_vert(), BM_ELEM_CD_GET_FLOAT, BM_face_vert_share_loop(), BevelParams::bweight_offset_edge, BMVert::co, copy_v3_v3(), EdgeHalf::e, edge_edge_angle_less_than_180(), EdgeHalf::fnext, EdgeHalf::fprev, l, BevelParams::offset, BevelParams::offset_type, slide_dist(), BevelParams::use_weights, v, and v2.
Referenced by offset_meet().
|
static |
Calculate the best place for a meeting point for the offsets from edges e1 and e2 on the in-between edge emid. Viewed from the vertex normal side, the CCW order of these edges is e1, emid, e2. Return true if we placed meetco as compromise between where two edges met. If we did, put the ratio of sines of angles in *r_sinratio too. However, if the bp->offset_type is BEVEL_AMT_PERCENT or BEVEL_AMT_ABSOLUTE, we just slide along emid by the specified amount.
Definition at line 1788 of file bmesh_bevel.cc.
References BEVEL_AMT_ABSOLUTE, BEVEL_AMT_PERCENT, BLI_assert, BM_edge_other_vert(), BM_ELEM_CD_GET_FLOAT, BevelParams::bweight_offset_edge, copy_v3_v3(), EdgeHalf::e, ELEM, interp_v3_v3v3(), EdgeHalf::is_bev, madd_v3_v3v3fl(), mid_v3_v3v3(), normalize_v3(), BevelParams::offset, offset_meet_edge(), EdgeHalf::offset_r, BevelParams::offset_type, sinf, slide_dist(), sub_v3_v3v3(), BevelParams::use_weights, v, and v2.
Referenced by build_boundary().
|
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 4829 of file bmesh_bevel.cc.
References adj_vmesh(), BEVEL_PROFILE_CUSTOM, NewVert::co, VMesh::count, ELEM, float, i, BoundVert::index, interp_v3_v3v3(), is_canon(), max_ii(), mesh_vert(), min_ff(), BoundVert::next, BevelParams::profile_type, VMesh::seg, snap_to_pipe_profile(), and BevVert::vmesh.
Referenced by bevel_build_rings().
Do the edges at bv form a "pipe"? Current definition: 3 or 4 beveled edges, 2 in line with each other, with other edges on opposite sides of the pipe if there are 4. Also, the vertex boundary should have 3 or 4 vertices in it, and all of the faces involved should be parallel to the pipe edges. Return the boundary vert whose ebev is one of the pipe edges, and whose next boundary vert has a beveled, non-pipe edge.
Definition at line 3979 of file bmesh_bevel.cc.
References angle_normalized_v3v3(), BEVEL_EPSILON_ANG, BEVEL_EPSILON_BIG, BM_edge_other_vert(), VMesh::boundstart, BMVert::co, VMesh::count, dot_v3v3(), e, EdgeHalf::e, BoundVert::ebev, BevVert::edgecount, BevVert::edges, fabsf, BoundVert::next, normalize_v3(), BevVert::selcount, sub_v3_v3v3(), BevVert::v, v2, and BevVert::vmesh.
Referenced by build_vmesh().
|
static |
Definition at line 1356 of file bmesh_bevel.cc.
References angle_normalized_v3v3(), BEVEL_EPSILON_ANG, BM_edge_other_vert(), BMVert::co, cross_v3_v3v3(), dot_v3v3(), EdgeHalf::e, float, M_PI, BMFace::no, normalize_v3(), sub_v3_v3v3(), v, and v2.
Referenced by offset_meet().
|
static |
Definition at line 1885 of file bmesh_bevel.cc.
References BLI_assert_msg, copy_v3_v3(), e, and isect_line_line_v3().
Referenced by set_profile_params().
Find where the coordinates of the BndVerts in bv should snap to in face f. Face f should contain vertex bv->v. Project the snapped verts to 2d, then return the area of the resulting polygon. Usually one BndVert is inside the face, sometimes up to 3 (if there are miters), so don't snap those to an edge; all the rest snap to one of the edges of bmf incident on bv->v.
Definition at line 4968 of file bmesh_bevel.cc.
References area_poly_v2(), axis_dominant_v3_to_m3(), BLI_array_alloca, BLI_assert, VMesh::boundstart, closest_to_line_segment_v3(), BMVert::co, VMesh::count, ELEM, find_face_internal_boundverts(), float, get_incident_edges(), i, len_squared_v3v3(), mul_v2_m3v3(), BMFace::no, BevVert::v, v, BMEdge::v1, BMEdge::v2, and BevVert::vmesh.
Referenced by is_bad_uv_poly().
|
static |
Definition at line 450 of file bmesh_bevel.cc.
References BLI_ghash_insert(), BevelParams::face_hash, and POINTER_FROM_INT.
Referenced by bev_rebuild_polygon(), bevel_build_edge_polygons(), bevel_build_poly(), bevel_build_rings(), bevel_build_trifan(), and build_center_ngon().
|
static |
Create and register new UVFace object based on a new face (BMFace *fnew); and assign proper representative face from either frep or frep_arr arguments.
Definition at line 645 of file bmesh_bevel.cc.
References UVFace::attached_frep, BLI_ghash_insert(), BLI_memarena_alloc(), UVFace::f, BevelParams::mem_arena, and BevelParams::uv_face_hash.
Referenced by bev_create_ngon().
|
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.
Definition at line 3659 of file bmesh_bevel.cc.
References NewVert::co, find_bevvert(), find_edge_half(), i, EdgeHalf::is_bev, BoundVert::is_profile_start, EdgeHalf::leftv, next_edgehalf_bev(), BoundVert::nv, EdgeHalf::rightv, BMEdge::v1, and EdgeHalf::visited_rpo.
Referenced by BM_mesh_bevel().
|
static |
Definition at line 4120 of file bmesh_bevel.cc.
References cos, M_PI, M_SQRT3, pow, sqrt, x, and y.
Referenced by cubic_subdiv().
|
static |
Definition at line 2821 of file bmesh_bevel.cc.
References BevVert::any_seam, BM_ELEM_SEAM, BM_ELEM_SMOOTH, VMesh::boundstart, check_edge_data_seam_sharp_edges(), e, v, and BevVert::vmesh.
Referenced by build_boundary(), build_boundary_terminal_edge(), and build_boundary_vertex_only().
|
static |
Definition at line 1901 of file bmesh_bevel.cc.
References add_v3_v3v3(), BevelParams::affect_type, BEVEL_AFFECT_VERTICES, BMVert::co, NewVert::co, copy_v3_v3(), cross_v3_v3v3(), e, BoundVert::ebev, Profile::end, BoundVert::is_arc_start, isect_line_line_v3(), mid_v3_v3v3(), Profile::middle, nearly_parallel(), negate_v3(), BoundVert::next, normalize_v3(), BoundVert::nv, Profile::plane_co, Profile::plane_no, PRO_CIRCLE_R, PRO_LINE_R, BevelParams::pro_super_r, BoundVert::profile, Profile::proj_dir, project_to_edge(), BevVert::selcount, Profile::start, sub_v3_v3v3(), Profile::super_r, BevVert::v, and zero_v3().
Referenced by build_boundary_terminal_edge(), build_vmesh(), and calculate_vm_profiles().
|
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. |
Definition at line 7540 of file bmesh_bevel.cc.
References BKE_curveprofile_init(), BLI_memarena_alloc(), BevelParams::custom_profile, find_even_superellipse_chords(), i, max_ii(), BevelParams::mem_arena, power_of_2_max_i(), BevelParams::pro_spacing, BevelParams::pro_super_r, BevelParams::seg, ProfileSpacing::seg_2, CurveProfile::segments, CurveProfile::segments_len, CurveProfilePoint::x, ProfileSpacing::xvals, ProfileSpacing::xvals_2, CurveProfilePoint::y, ProfileSpacing::yvals, and ProfileSpacing::yvals_2.
Referenced by BM_mesh_bevel().
Definition at line 1283 of file bmesh_bevel.cc.
References BEVEL_EPSILON_D, BM_edge_other_vert(), copy_v3_v3(), e, float, len, madd_v3_v3fl(), normalize_v3(), sub_v3_v3v3(), and v.
Referenced by build_boundary_terminal_edge(), build_boundary_vertex_only(), offset_meet(), offset_meet_lines_percent_or_absolute(), and offset_on_edge_between().
|
static |
Definition at line 5408 of file bmesh_bevel.cc.
References i.
Referenced by snap_edges_for_vmesh_vert().
|
static |
Fill the r_snap_edges array with the edges to snap to (or NUL, if no snapping) for the adj mesh face with lower left corner at (i, ring j, segment k). The indices of the four corners are (i,j,k), (i,j,k+1), (i,j+1,k+1), (i,j+1,k). The answer will be one of nullptr (don't snap), eprev (the edge between boundvert i and boundvert i-1), or enext (the edge between boundvert i and boundvert i+1). When n is odd, the center column (seg ns2) is ambiguous as to whether it interpolates in the current boundvert's frep [= interpolation face] or the next one's. Similarly, when n is odd, the center row (ring ns2) is ambiguous as to whether it interpolates in the current boundvert's frep or the previous one's. Parameter frep_beats_next should have an array of size n_bndv of booleans that say whether the tie should be broken in favor of the next boundvert's frep (if true) or the current one's. For vertices in the center polygon (when ns is odd), the snapping edge depends on where the boundvert is in relation to the boundvert that has the center face's frep, so the arguments bndv_rep_faces is an array of size n_bndv give the freps for each i, and center_frep is the frep for the center.
NOTE: this function is for edge bevels only, at the moment.
Definition at line 5453 of file bmesh_bevel.cc.
References BLI_assert, ELEM, i, and snap_edge_for_center_vmesh_vert().
Referenced by bevel_build_rings().
Snap co to the closest point on the profile for vpipe projected onto the plane containing co with normal in the direction of edge vpipe->ebev. For the square profiles, need to decide whether to snap to just one plane or to the midpoint of the profile; do so if midline is true.
Definition at line 4785 of file bmesh_bevel.cc.
References BEVEL_EPSILON_D, closest_to_line_segment_v3(), closest_to_plane_v3(), compare_v3v3(), copy_v3_v3(), e, BoundVert::ebev, Profile::end, invert_m4_m4(), make_unit_square_map(), Profile::middle, mul_v3_m4v3(), plane_from_point_normal_v3(), BoundVert::profile, snap(), snap_to_superellipsoid(), Profile::start, sub_v3_v3v3(), and Profile::super_r.
Referenced by pipe_adj_vmesh().
Snap a direction co to a superellipsoid with parameter super_r. For square profiles, midline says whether or not to snap to both planes.
Only currently used for the pipe and cube corner special cases.
Definition at line 2400 of file bmesh_bevel.cc.
References b, BEVEL_EPSILON, BLI_assert, ELEM, fabsf, max_ff(), min_ff(), normalize_v3(), powf, PRO_CIRCLE_R, PRO_SQUARE_IN_R, PRO_SQUARE_R, x, y, and z().
Referenced by make_cube_corner_adj_vmesh(), and snap_to_pipe_profile().
|
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 5183 of file bmesh_bevel.cc.
References add_v3_v3v3(), ANGLE_SMALLER, ANGLE_STRAIGHT, angle_v3v3v3(), BEVEL_SMALL_ANG, VMesh::boundstart, closer_v3_v3v3v3(), closest_to_line_segment_v3(), BMVert::co, NewVert::co, copy_v3_v3(), VMesh::count, EdgeHalf::e, edges_angle_kind(), BoundVert::efirst, BoundVert::elast, float, i, interp_v3_v3v3(), BoundVert::is_arc_start, BoundVert::is_patch_start, isect_line_line_v3(), BevelParams::mem_arena, MEM_calloc_arrayN(), MEM_freeN(), MEM_malloc_arrayN(), mesh_vert(), mid_v3_v3v3(), Profile::middle, new_adj_vmesh(), BoundVert::next, BoundVert::nv, BoundVert::prev, BoundVert::profile, VMesh::seg, sinf, sub_v3_v3v3(), BevVert::v, BMEdge::v1, BMEdge::v2, BevVert::vmesh, and vmesh_copy_equiv_verts().
Referenced by bevel_build_rings().
|
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 2230 of file bmesh_bevel.cc.
References BLI_assert, pow, and x.
Referenced by find_even_superellipse_chords_general(), and find_superellipse_chord_endpoint().
|
static |
In array face_component of total totface elements, swap values c1 and c2 wherever they occur.
Definition at line 1040 of file bmesh_bevel.cc.
Referenced by math_layer_info_init().
|
static |
Definition at line 4682 of file bmesh_bevel.cc.
References VMesh::boundstart, BMVert::co, NewVert::co, copy_v3_v3(), i, make_cube_corner_adj_vmesh(), make_unit_cube_map(), mesh_vert(), mul_m4_v4(), BoundVert::next, BoundVert::nv, BevelParams::seg, BevVert::v, v, and BevVert::vmesh.
Referenced by adj_vmesh(), and bevel_build_rings().
|
static |
Definition at line 4634 of file bmesh_bevel.cc.
References BevelParams::affect_type, BEVEL_AFFECT_VERTICES, BEVEL_EPSILON, BEVEL_PROFILE_CUSTOM, BM_edge_calc_face_angle_signed_ex(), compare_ff(), VMesh::count, e, BevVert::edgecount, BevVert::edges, fabsf, i, M_PI, M_PI_2, M_PI_4, EdgeHalf::offset_l, PRO_SQUARE_R, BevelParams::pro_super_r, BevelParams::profile_type, BevVert::selcount, and BevVert::vmesh.
Referenced by adj_vmesh(), and bevel_build_rings().
|
static |
Update UV vert map with new loops (BMLoop) from a face (uv_face->f) to keep track of proper UV connectivity. This data will help with merging UV verts later. Loops stored in the same UV vert bucket will be merged together (their UV positions).
Definition at line 676 of file bmesh_bevel.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), UVFace::attached_frep, BLI_assert, BM_face_vert_share_loop(), BM_ITER_ELEM, BM_LOOPS_OF_FACE, BM_LOOPS_OF_VERT, BMLoop::f, UVFace::f, find_uv_face(), l, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr(), and BevelParams::uv_vert_maps.
Referenced by bev_create_ngon().
|
static |
Initialize bp->uv_vert_maps to the size equal to the number of UV layers.
Definition at line 1058 of file bmesh_bevel.cc.
References bm, CD_PROP_FLOAT2, CustomData_number_of_layers(), and BevelParams::uv_vert_maps.
Referenced by BM_mesh_bevel().
|
static |
Remove vertex v from all UV maps in bp->uv_vert_maps.
Definition at line 1068 of file bmesh_bevel.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::pop_try(), BevelParams::uv_vert_maps, and v.
Referenced by BM_mesh_bevel().
|
static |
We have an edge A between vertices a and b, where EdgeHalf ea is the half of A that starts at a. For vertex-only bevels, the new vertices slide from a at a rate ka*t and from b at a rate kb*t. We want to calculate the t at which the two meet.
Definition at line 7778 of file bmesh_bevel.cc.
References BM_edge_calc_length(), EdgeHalf::e, find_other_end_edge_half(), BevelParams::offset, and EdgeHalf::offset_l_spec.
Referenced by bevel_limit_offset().
Definition at line 4094 of file bmesh_bevel.cc.
References add_v3_v3(), copy_v3_v3(), VMesh::count, i, mesh_vert(), mul_v3_fl(), VMesh::seg, and zero_v3().
Referenced by interp_vmesh().
|
static |
Definition at line 4073 of file bmesh_bevel.cc.
References NewVert::co, copy_v3_v3(), VMesh::count, i, is_canon(), mesh_vert(), mesh_vert_canon(), VMesh::seg, and NewVert::v.
Referenced by adj_vmesh(), bevel_build_rings(), cubic_subdiv(), interp_vmesh(), make_cube_corner_adj_vmesh(), make_cube_corner_square(), and square_out_adj_vmesh().
|
static |
Copy edge attribute data across the non-beveled crossing edges of a cross weld.
Situation looks like this:
e->next |
----—3----— ----—2----— ----—1----— e ----—0---— | e->prev
where e is the EdgeHalf of one of the beveled edges, e->next and e->prev are EdgeHalfs for the unbeveled edges of the cross and their attributes are to be copied to the edges 01, 12, 23. The vert i is mesh_vert(vm, vmindex, 0, i)->v.
Definition at line 7040 of file bmesh_bevel.cc.
References BLI_assert, bm, BM_edge_exists(), BM_elem_attrs_copy(), BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_ELEM_SEAM, BM_ELEM_SMOOTH, e, BevVert::edges, i, mesh_vert(), and v.
Referenced by bevel_build_edge_polygons().