Blender  V2.93
Classes | Macros | Typedefs | Enumerations | Functions | Variables
uvedit_parametrizer.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_boxpack_2d.h"
#include "BLI_convexhull_2d.h"
#include "BLI_heap.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_polyfill_2d.h"
#include "BLI_polyfill_2d_beautify.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "uvedit_parametrizer.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "BLI_sys_types.h"
#include "eigen_capi.h"

Go to the source code of this file.

Classes

struct  PHashLink
 
struct  PHash
 
struct  PVert
 
union  PVert::PVertUnion
 
struct  PEdge
 
union  PEdge::PEdgeUnion
 
struct  PFace
 
union  PFace::PFaceUnion
 
struct  PChart
 
union  PChart::PChartUnion
 
struct  PChart::PChartUnion::PChartLscm
 
struct  PChart::PChartUnion::PChartPack
 
struct  PHandle
 
struct  PAbfSystem
 
struct  SmoothTriangle
 
struct  SmoothNode
 

Macros

#define param_assert(condition)
 
#define param_warning(message)    {/*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/}(void)0
 
#define PEDGE_VERTEX_FLAGS   (PEDGE_PIN)
 
#define PHASH_hash(ph, item)   (((uintptr_t)(item)) % ((uint)(ph)->cursize))
 
#define PHASH_edge(v1, v2)   (((v1) < (v2)) ? ((v1)*39) ^ ((v2)*31) : ((v1)*31) ^ ((v2)*39))
 
#define ABF_MAX_ITER   20
 
#define P_STRETCH_ITER   20
 

Typedefs

typedef enum PBool PBool
 
typedef intptr_t PHashKey
 
typedef struct PHashLink PHashLink
 
typedef struct PHash PHash
 
typedef struct PVert PVert
 
typedef struct PEdge PEdge
 
typedef struct PFace PFace
 
typedef struct PChart PChart
 
typedef struct PHandle PHandle
 
typedef struct PAbfSystem PAbfSystem
 
typedef struct SmoothTriangle SmoothTriangle
 
typedef struct SmoothNode SmoothNode
 

Enumerations

enum  PBool { P_TRUE = 1 , P_FALSE = 0 }
 
enum  PVertFlag {
  PVERT_PIN = 1 , PVERT_SELECT = 2 , PVERT_INTERIOR = 4 , PVERT_COLLAPSE = 8 ,
  PVERT_SPLIT = 16
}
 
enum  PEdgeFlag {
  PEDGE_SEAM = 1 , PEDGE_VERTEX_SPLIT = 2 , PEDGE_PIN = 4 , PEDGE_SELECT = 8 ,
  PEDGE_DONE = 16 , PEDGE_FILLED = 32 , PEDGE_COLLAPSE = 64 , PEDGE_COLLAPSE_EDGE = 128 ,
  PEDGE_COLLAPSE_PAIR = 256
}
 
enum  PFaceFlag { PFACE_CONNECTED = 1 , PFACE_FILLED = 2 , PFACE_COLLAPSE = 4 }
 
enum  PChartFlag { PCHART_HAS_PINS = 1 }
 
enum  PHandleState { PHANDLE_STATE_ALLOCATED , PHANDLE_STATE_CONSTRUCTED , PHANDLE_STATE_LSCM , PHANDLE_STATE_STRETCH }
 

Functions

static PHashphash_new (PHashLink **list, int sizehint)
 
static void phash_delete (PHash *ph)
 
static int phash_size (PHash *ph)
 
static void phash_insert (PHash *ph, PHashLink *link)
 
static PHashLinkphash_lookup (PHash *ph, PHashKey key)
 
static PHashLinkphash_next (PHash *ph, PHashKey key, PHashLink *link)
 
static float p_vec_angle_cos (const float v1[3], const float v2[3], const float v3[3])
 
static float p_vec_angle (const float v1[3], const float v2[3], const float v3[3])
 
static float p_vec2_angle (const float v1[2], const float v2[2], const float v3[2])
 
static void p_triangle_angles (const float v1[3], const float v2[3], const float v3[3], float *r_a1, float *r_a2, float *r_a3)
 
static void p_face_angles (PFace *f, float *r_a1, float *r_a2, float *r_a3)
 
static float p_face_area (PFace *f)
 
static float p_area_signed (const float v1[2], const float v2[2], const float v3[2])
 
static float p_face_uv_area_signed (PFace *f)
 
static float p_edge_length (PEdge *e)
 
static float p_edge_uv_length (PEdge *e)
 
static void p_chart_uv_bbox (PChart *chart, float minv[2], float maxv[2])
 
static float p_chart_uv_area (PChart *chart)
 
static void p_chart_uv_scale (PChart *chart, float scale)
 
static void p_chart_uv_scale_xy (PChart *chart, float x, float y)
 
static void p_chart_uv_translate (PChart *chart, const float trans[2])
 
static void p_chart_uv_transform (PChart *chart, const float mat[2][2])
 
static void p_chart_uv_to_array (PChart *chart, float(*points)[2])
 
static void UNUSED_FUNCTION() p_chart_uv_from_array (PChart *chart, float(*points)[2])
 
static PBool p_intersect_line_2d_dir (const float v1[2], const float dir1[2], const float v2[2], const float dir2[2], float r_isect[2])
 
static PEdgep_wheel_edge_next (PEdge *e)
 
static PEdgep_wheel_edge_prev (PEdge *e)
 
static PEdgep_boundary_edge_next (PEdge *e)
 
static PEdgep_boundary_edge_prev (PEdge *e)
 
static PBool p_vert_interior (PVert *v)
 
static void p_face_flip (PFace *f)
 
static void p_vert_load_pin_select_uvs (PHandle *handle, PVert *v)
 
static void p_flush_uvs (PHandle *handle, PChart *chart)
 
static void p_flush_uvs_blend (PHandle *handle, PChart *chart, float blend)
 
static void p_face_backup_uvs (PFace *f)
 
static void p_face_restore_uvs (PFace *f)
 
static PVertp_vert_add (PHandle *handle, PHashKey key, const float co[3], PEdge *e)
 
static PVertp_vert_lookup (PHandle *handle, PHashKey key, const float co[3], PEdge *e)
 
static PVertp_vert_copy (PChart *chart, PVert *v)
 
static PEdgep_edge_lookup (PHandle *handle, const PHashKey *vkeys)
 
static int p_face_exists (ParamHandle *phandle, ParamKey *pvkeys, int i1, int i2, int i3)
 
static PChartp_chart_new (PHandle *handle)
 
static void p_chart_delete (PChart *chart)
 
static PBool p_edge_implicit_seam (PEdge *e, PEdge *ep)
 
static PBool p_edge_has_pair (PHandle *handle, PEdge *e, PBool topology_from_uvs, PEdge **r_pair)
 
static PBool p_edge_connect_pair (PHandle *handle, PEdge *e, PBool topology_from_uvs, PEdge ***stack)
 
static int p_connect_pairs (PHandle *handle, PBool topology_from_uvs)
 
static void p_split_vert (PChart *chart, PEdge *e)
 
static PChart ** p_split_charts (PHandle *handle, PChart *chart, int ncharts)
 
static PFacep_face_add (PHandle *handle)
 
static PFacep_face_add_construct (PHandle *handle, ParamKey key, const ParamKey *vkeys, float *co[4], float *uv[4], int i1, int i2, int i3, const ParamBool *pin, const ParamBool *select)
 
static PFacep_face_add_fill (PChart *chart, PVert *v1, PVert *v2, PVert *v3)
 
static PBool p_quad_split_direction (PHandle *handle, float **co, PHashKey *vkeys)
 
static void p_chart_boundaries (PChart *chart, int *r_nboundaries, PEdge **r_outer)
 
static float p_edge_boundary_angle (PEdge *e)
 
static void p_chart_fill_boundary (PChart *chart, PEdge *be, int nedges)
 
static void p_chart_fill_boundaries (PChart *chart, PEdge *outer)
 
static void p_abf_setup_system (PAbfSystem *sys)
 
static void p_abf_free_system (PAbfSystem *sys)
 
static void p_abf_compute_sines (PAbfSystem *sys)
 
static float p_abf_compute_sin_product (PAbfSystem *sys, PVert *v, int aid)
 
static float p_abf_compute_grad_alpha (PAbfSystem *sys, PFace *f, PEdge *e)
 
static float p_abf_compute_gradient (PAbfSystem *sys, PChart *chart)
 
static PBool p_abf_matrix_invert (PAbfSystem *sys, PChart *chart)
 
static PBool p_chart_abf_solve (PChart *chart)
 
static void p_chart_pin_positions (PChart *chart, PVert **pin1, PVert **pin2)
 
static PBool p_chart_symmetry_pins (PChart *chart, PEdge *outer, PVert **pin1, PVert **pin2)
 
static void p_chart_extrema_verts (PChart *chart, PVert **pin1, PVert **pin2)
 
static void p_chart_lscm_load_solution (PChart *chart)
 
static void p_chart_lscm_begin (PChart *chart, PBool live, PBool abf)
 
static PBool p_chart_lscm_solve (PHandle *handle, PChart *chart)
 
static void p_chart_lscm_transform_single_pin (PChart *chart)
 
static void p_chart_lscm_end (PChart *chart)
 
static void p_stretch_pin_boundary (PChart *chart)
 
static float p_face_stretch (PFace *f)
 
static float p_stretch_compute_vertex (PVert *v)
 
static void p_chart_stretch_minimize (PChart *chart, RNG *rng)
 
static int p_compare_geometric_uv (const void *a, const void *b)
 
static PBool p_chart_convex_hull (PChart *chart, PVert ***r_verts, int *r_nverts, int *r_right)
 
static float p_rectangle_area (float *p1, float *dir, float *p2, float *p3, float *p4)
 
static float p_chart_minimum_area_angle (PChart *chart)
 
static void p_chart_rotate_minimum_area (PChart *chart)
 
static void p_chart_rotate_fit_aabb (PChart *chart)
 
static void p_barycentric_2d (const float v1[2], const float v2[2], const float v3[2], const float p[2], float b[3])
 
static PBool p_triangle_inside (SmoothTriangle *t, float co[2])
 
static SmoothNodep_node_new (MemArena *arena, SmoothTriangle **tri, int ntri, float *bmin, float *bmax, int depth)
 
static void p_node_delete (SmoothNode *node)
 
static PBool p_node_intersect (SmoothNode *node, float co[2])
 
static int p_compare_float (const void *a_, const void *b_)
 
static float p_smooth_median_edge_length (PChart *chart)
 
static float p_smooth_distortion (PEdge *e, float avg2d, float avg3d)
 
static void p_smooth (PChart *chart)
 
ParamHandleparam_construct_begin (void)
 
void param_aspect_ratio (ParamHandle *handle, float aspx, float aspy)
 
void param_delete (ParamHandle *handle)
 
static void p_add_ngon (ParamHandle *handle, ParamKey key, int nverts, ParamKey *vkeys, float **co, float **uv, ParamBool *pin, ParamBool *select)
 
void param_face_add (ParamHandle *handle, ParamKey key, int nverts, ParamKey *vkeys, float *co[4], float *uv[4], ParamBool *pin, ParamBool *select)
 
void param_edge_set_seam (ParamHandle *handle, ParamKey *vkeys)
 
void param_construct_end (ParamHandle *handle, ParamBool fill, ParamBool topology_from_uvs, int *count_fail)
 
void param_lscm_begin (ParamHandle *handle, ParamBool live, ParamBool abf)
 
void param_lscm_solve (ParamHandle *handle, int *count_changed, int *count_failed)
 
void param_lscm_end (ParamHandle *handle)
 
void param_stretch_begin (ParamHandle *handle)
 
void param_stretch_blend (ParamHandle *handle, float blend)
 
void param_stretch_iter (ParamHandle *handle)
 
void param_stretch_end (ParamHandle *handle)
 
void param_smooth_area (ParamHandle *handle)
 
static void param_pack_rotate (ParamHandle *handle, bool ignore_pinned)
 
void param_pack (ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned)
 
void param_average (ParamHandle *handle, bool ignore_pinned)
 
void param_scale (ParamHandle *handle, float x, float y)
 
void param_flush (ParamHandle *handle)
 
void param_flush_restore (ParamHandle *handle)
 

Variables

static int PHashSizes []
 

Macro Definition Documentation

◆ ABF_MAX_ITER

#define ABF_MAX_ITER   20

Definition at line 2408 of file uvedit_parametrizer.c.

◆ P_STRETCH_ITER

#define P_STRETCH_ITER   20

Definition at line 3416 of file uvedit_parametrizer.c.

◆ param_assert

#define param_assert (   condition)
Value:
if (!(condition)) { /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ \
} \
(void)0

Definition at line 46 of file uvedit_parametrizer.c.

◆ param_warning

#define param_warning (   message)     {/*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/}(void)0

Definition at line 50 of file uvedit_parametrizer.c.

◆ PEDGE_VERTEX_FLAGS

#define PEDGE_VERTEX_FLAGS   (PEDGE_PIN)

Definition at line 152 of file uvedit_parametrizer.c.

◆ PHASH_edge

#define PHASH_edge (   v1,
  v2 
)    (((v1) < (v2)) ? ((v1)*39) ^ ((v2)*31) : ((v1)*31) ^ ((v2)*39))

Definition at line 236 of file uvedit_parametrizer.c.

◆ PHASH_hash

#define PHASH_hash (   ph,
  item 
)    (((uintptr_t)(item)) % ((uint)(ph)->cursize))

Definition at line 235 of file uvedit_parametrizer.c.

Typedef Documentation

◆ PAbfSystem

typedef struct PAbfSystem PAbfSystem

◆ PBool

typedef enum PBool PBool

◆ PChart

typedef struct PChart PChart

◆ PEdge

typedef struct PEdge PEdge

◆ PFace

typedef struct PFace PFace

◆ PHandle

typedef struct PHandle PHandle

◆ PHash

typedef struct PHash PHash

◆ PHashKey

typedef intptr_t PHashKey

Definition at line 60 of file uvedit_parametrizer.c.

◆ PHashLink

typedef struct PHashLink PHashLink

◆ PVert

typedef struct PVert PVert

◆ SmoothNode

typedef struct SmoothNode SmoothNode

◆ SmoothTriangle

Enumeration Type Documentation

◆ PBool

enum PBool
Enumerator
P_TRUE 
P_FALSE 

Definition at line 53 of file uvedit_parametrizer.c.

◆ PChartFlag

enum PChartFlag
Enumerator
PCHART_HAS_PINS 

Definition at line 191 of file uvedit_parametrizer.c.

◆ PEdgeFlag

enum PEdgeFlag
Enumerator
PEDGE_SEAM 
PEDGE_VERTEX_SPLIT 
PEDGE_PIN 
PEDGE_SELECT 
PEDGE_DONE 
PEDGE_FILLED 
PEDGE_COLLAPSE 
PEDGE_COLLAPSE_EDGE 
PEDGE_COLLAPSE_PAIR 

Definition at line 139 of file uvedit_parametrizer.c.

◆ PFaceFlag

enum PFaceFlag
Enumerator
PFACE_CONNECTED 
PFACE_FILLED 
PFACE_COLLAPSE 

Definition at line 154 of file uvedit_parametrizer.c.

◆ PHandleState

Enumerator
PHANDLE_STATE_ALLOCATED 
PHANDLE_STATE_CONSTRUCTED 
PHANDLE_STATE_LSCM 
PHANDLE_STATE_STRETCH 

Definition at line 195 of file uvedit_parametrizer.c.

◆ PVertFlag

enum PVertFlag
Enumerator
PVERT_PIN 
PVERT_SELECT 
PVERT_INTERIOR 
PVERT_COLLAPSE 
PVERT_SPLIT 

Definition at line 131 of file uvedit_parametrizer.c.

Function Documentation

◆ p_abf_compute_grad_alpha()

static float p_abf_compute_grad_alpha ( PAbfSystem sys,
PFace f,
PEdge e 
)
static

◆ p_abf_compute_gradient()

static float p_abf_compute_gradient ( PAbfSystem sys,
PChart chart 
)
static

◆ p_abf_compute_sin_product()

static float p_abf_compute_sin_product ( PAbfSystem sys,
PVert v,
int  aid 
)
static

◆ p_abf_compute_sines()

static void p_abf_compute_sines ( PAbfSystem sys)
static

◆ p_abf_free_system()

static void p_abf_free_system ( PAbfSystem sys)
static

◆ p_abf_matrix_invert()

static PBool p_abf_matrix_invert ( PAbfSystem sys,
PChart chart 
)
static

◆ p_abf_setup_system()

static void p_abf_setup_system ( PAbfSystem sys)
static

◆ p_add_ngon()

static void p_add_ngon ( ParamHandle handle,
ParamKey  key,
int  nverts,
ParamKey vkeys,
float **  co,
float **  uv,
ParamBool pin,
ParamBool select 
)
static

◆ p_area_signed()

static float p_area_signed ( const float  v1[2],
const float  v2[2],
const float  v3[2] 
)
static

Definition at line 409 of file uvedit_parametrizer.c.

References v1, and v2.

Referenced by p_chart_convex_hull().

◆ p_barycentric_2d()

static void p_barycentric_2d ( const float  v1[2],
const float  v2[2],
const float  v3[2],
const float  p[2],
float  b[3] 
)
static

Definition at line 3854 of file uvedit_parametrizer.c.

References Freestyle::a, Freestyle::c, v1, and v2.

Referenced by p_smooth(), and p_triangle_inside().

◆ p_boundary_edge_next()

static PEdge* p_boundary_edge_next ( PEdge e)
static

Definition at line 587 of file uvedit_parametrizer.c.

References e.

Referenced by p_chart_convex_hull(), p_chart_fill_boundary(), and p_chart_symmetry_pins().

◆ p_boundary_edge_prev()

static PEdge* p_boundary_edge_prev ( PEdge e)
static

Definition at line 592 of file uvedit_parametrizer.c.

References e, and p_wheel_edge_next().

Referenced by p_chart_fill_boundary(), and p_chart_symmetry_pins().

◆ p_chart_abf_solve()

static PBool p_chart_abf_solve ( PChart chart)
static

◆ p_chart_boundaries()

static void p_chart_boundaries ( PChart chart,
int *  r_nboundaries,
PEdge **  r_outer 
)
static

◆ p_chart_convex_hull()

static PBool p_chart_convex_hull ( PChart chart,
PVert ***  r_verts,
int *  r_nverts,
int *  r_right 
)
static

◆ p_chart_delete()

static void p_chart_delete ( PChart chart)
static

Definition at line 858 of file uvedit_parametrizer.c.

References MEM_freeN.

Referenced by param_construct_end(), and param_delete().

◆ p_chart_extrema_verts()

static void p_chart_extrema_verts ( PChart chart,
PVert **  pin1,
PVert **  pin2 
)
static

Definition at line 3106 of file uvedit_parametrizer.c.

References BMVert::co, NULL, p_chart_pin_positions(), v, and PChart::verts.

Referenced by p_chart_lscm_begin().

◆ p_chart_fill_boundaries()

static void p_chart_fill_boundaries ( PChart chart,
PEdge outer 
)
static

◆ p_chart_fill_boundary()

static void p_chart_fill_boundary ( PChart chart,
PEdge be,
int  nedges 
)
static

◆ p_chart_lscm_begin()

static void p_chart_lscm_begin ( PChart chart,
PBool  live,
PBool  abf 
)
static

◆ p_chart_lscm_end()

static void p_chart_lscm_end ( PChart chart)
static

◆ p_chart_lscm_load_solution()

static void p_chart_lscm_load_solution ( PChart chart)
static

◆ p_chart_lscm_solve()

static PBool p_chart_lscm_solve ( PHandle handle,
PChart chart 
)
static

◆ p_chart_lscm_transform_single_pin()

static void p_chart_lscm_transform_single_pin ( PChart chart)
static

◆ p_chart_minimum_area_angle()

static float p_chart_minimum_area_angle ( PChart chart)
static

◆ p_chart_new()

static PChart* p_chart_new ( PHandle handle)
static

Definition at line 850 of file uvedit_parametrizer.c.

References PChart::handle, and MEM_callocN.

Referenced by p_split_charts(), and param_construct_begin().

◆ p_chart_pin_positions()

static void p_chart_pin_positions ( PChart chart,
PVert **  pin1,
PVert **  pin2 
)
static

◆ p_chart_rotate_fit_aabb()

static void p_chart_rotate_fit_aabb ( PChart chart)
static

◆ p_chart_rotate_minimum_area()

static void p_chart_rotate_minimum_area ( PChart chart)
static

Definition at line 3807 of file uvedit_parametrizer.c.

References angle(), cosf, p_chart_minimum_area_angle(), sinf, v, and PChart::verts.

Referenced by param_lscm_solve().

◆ p_chart_stretch_minimize()

static void p_chart_stretch_minimize ( PChart chart,
RNG rng 
)
static

◆ p_chart_symmetry_pins()

static PBool p_chart_symmetry_pins ( PChart chart,
PEdge outer,
PVert **  pin1,
PVert **  pin2 
)
static

◆ p_chart_uv_area()

static float p_chart_uv_area ( PChart chart)
static

◆ p_chart_uv_bbox()

static void p_chart_uv_bbox ( PChart chart,
float  minv[2],
float  maxv[2] 
)
static

Definition at line 446 of file uvedit_parametrizer.c.

References INIT_MINMAX2, minmax_v2v2_v2(), v, and PChart::verts.

Referenced by p_smooth(), param_average(), and param_pack().

◆ p_chart_uv_from_array()

static void UNUSED_FUNCTION() p_chart_uv_from_array ( PChart chart,
float(*)  points[2] 
)
static

Definition at line 517 of file uvedit_parametrizer.c.

References copy_v2_v2(), v, and PChart::verts.

◆ p_chart_uv_scale()

static void p_chart_uv_scale ( PChart chart,
float  scale 
)
static

Definition at line 468 of file uvedit_parametrizer.c.

References v, and PChart::verts.

Referenced by p_chart_lscm_transform_single_pin(), param_average(), and param_pack().

◆ p_chart_uv_scale_xy()

static void p_chart_uv_scale_xy ( PChart chart,
float  x,
float  y 
)
static

Definition at line 478 of file uvedit_parametrizer.c.

References v, PChart::verts, x, and y.

Referenced by param_scale().

◆ p_chart_uv_to_array()

static void p_chart_uv_to_array ( PChart chart,
float(*)  points[2] 
)
static

Definition at line 507 of file uvedit_parametrizer.c.

References copy_v2_v2(), v, and PChart::verts.

Referenced by p_chart_rotate_fit_aabb().

◆ p_chart_uv_transform()

static void p_chart_uv_transform ( PChart chart,
const float  mat[2][2] 
)
static

Definition at line 498 of file uvedit_parametrizer.c.

References mul_m2_v2(), v, and PChart::verts.

Referenced by p_chart_rotate_fit_aabb().

◆ p_chart_uv_translate()

static void p_chart_uv_translate ( PChart chart,
const float  trans[2] 
)
static

Definition at line 488 of file uvedit_parametrizer.c.

References v, and PChart::verts.

Referenced by p_chart_lscm_transform_single_pin(), param_average(), and param_pack().

◆ p_compare_float()

static int p_compare_float ( const void *  a_,
const void *  b_ 
)
static

Definition at line 3992 of file uvedit_parametrizer.c.

References Freestyle::a.

Referenced by p_smooth_median_edge_length().

◆ p_compare_geometric_uv()

static int p_compare_geometric_uv ( const void *  a,
const void *  b 
)
static

Definition at line 3569 of file uvedit_parametrizer.c.

References Freestyle::a, v1, and v2.

Referenced by p_chart_convex_hull().

◆ p_connect_pairs()

static int p_connect_pairs ( PHandle handle,
PBool  topology_from_uvs 
)
static

◆ p_edge_boundary_angle()

static float p_edge_boundary_angle ( PEdge e)
static

Definition at line 1305 of file uvedit_parametrizer.c.

References angle(), BMVert::co, e, M_PI, PEdge::next, p_vec_angle(), PEdge::pair, v, v1, v2, and PEdge::vert.

Referenced by p_chart_fill_boundary().

◆ p_edge_connect_pair()

static PBool p_edge_connect_pair ( PHandle handle,
PEdge e,
PBool  topology_from_uvs,
PEdge ***  stack 
)
static

◆ p_edge_has_pair()

static PBool p_edge_has_pair ( PHandle handle,
PEdge e,
PBool  topology_from_uvs,
PEdge **  r_pair 
)
static

◆ p_edge_implicit_seam()

static PBool p_edge_implicit_seam ( PEdge e,
PEdge ep 
)
static

◆ p_edge_length()

static float p_edge_length ( PEdge e)
static

◆ p_edge_lookup()

static PEdge* p_edge_lookup ( PHandle handle,
const PHashKey vkeys 
)
static

Definition at line 806 of file uvedit_parametrizer.c.

References e, PHandle::hash_edges, NULL, PHASH_edge, phash_lookup(), and phash_next().

Referenced by param_edge_set_seam().

◆ p_edge_uv_length()

static float p_edge_uv_length ( PEdge e)
static

Definition at line 435 of file uvedit_parametrizer.c.

References e, sqrtf, v1, and v2.

Referenced by p_chart_stretch_minimize(), p_smooth(), and p_smooth_distortion().

◆ p_face_add()

static PFace* p_face_add ( PHandle handle)
static

◆ p_face_add_construct()

static PFace* p_face_add_construct ( PHandle handle,
ParamKey  key,
const ParamKey vkeys,
float co[4],
float uv[4],
int  i1,
int  i2,
int  i3,
const ParamBool pin,
const ParamBool select 
)
static

◆ p_face_add_fill()

static PFace* p_face_add_fill ( PChart chart,
PVert v1,
PVert v2,
PVert v3 
)
static

◆ p_face_angles()

static void p_face_angles ( PFace f,
float r_a1,
float r_a2,
float r_a3 
)
static

◆ p_face_area()

static float p_face_area ( PFace f)
static

Definition at line 401 of file uvedit_parametrizer.c.

References area_tri_v3(), BMVert::co, PFace::edge, PEdge::next, v1, v2, and PEdge::vert.

Referenced by param_average(), and param_stretch_begin().

◆ p_face_backup_uvs()

static void p_face_backup_uvs ( PFace f)
static

Definition at line 721 of file uvedit_parametrizer.c.

References PFace::edge, PEdge::next, PEdge::old_uv, and PEdge::orig_uv.

Referenced by param_lscm_begin(), and param_stretch_begin().

◆ p_face_exists()

static int p_face_exists ( ParamHandle phandle,
ParamKey pvkeys,
int  i1,
int  i2,
int  i3 
)
static

◆ p_face_flip()

static void p_face_flip ( PFace f)
static

◆ p_face_restore_uvs()

static void p_face_restore_uvs ( PFace f)
static

Definition at line 739 of file uvedit_parametrizer.c.

References PFace::edge, PEdge::next, PEdge::old_uv, and PEdge::orig_uv.

Referenced by param_flush_restore().

◆ p_face_stretch()

static float p_face_stretch ( PFace f)
static

◆ p_face_uv_area_signed()

static float p_face_uv_area_signed ( PFace f)
static

◆ p_flush_uvs()

static void p_flush_uvs ( PHandle handle,
PChart chart 
)
static

Definition at line 696 of file uvedit_parametrizer.c.

References PHandle::aspx, PHandle::aspy, e, and PChart::edges.

Referenced by param_flush().

◆ p_flush_uvs_blend()

static void p_flush_uvs_blend ( PHandle handle,
PChart chart,
float  blend 
)
static

Definition at line 708 of file uvedit_parametrizer.c.

References PHandle::aspx, PHandle::aspy, blend(), e, and PChart::edges.

Referenced by param_flush().

◆ p_intersect_line_2d_dir()

static PBool p_intersect_line_2d_dir ( const float  v1[2],
const float  dir1[2],
const float  v2[2],
const float  dir2[2],
float  r_isect[2] 
)
static

Definition at line 527 of file uvedit_parametrizer.c.

References P_FALSE, P_TRUE, v1, and v2.

Referenced by p_rectangle_area().

◆ p_node_delete()

static void p_node_delete ( SmoothNode node)
static

Definition at line 3957 of file uvedit_parametrizer.c.

References MEM_freeN, and node.

Referenced by p_smooth().

◆ p_node_intersect()

static PBool p_node_intersect ( SmoothNode node,
float  co[2] 
)
static

Definition at line 3970 of file uvedit_parametrizer.c.

References node, P_FALSE, p_triangle_inside(), and P_TRUE.

Referenced by p_smooth().

◆ p_node_new()

static SmoothNode* p_node_new ( MemArena arena,
SmoothTriangle **  tri,
int  ntri,
float bmin,
float bmax,
int  depth 
)
static

◆ p_quad_split_direction()

static PBool p_quad_split_direction ( PHandle handle,
float **  co,
PHashKey vkeys 
)
static

Definition at line 1236 of file uvedit_parametrizer.c.

References len_v3v3(), and p_face_exists().

Referenced by param_face_add().

◆ p_rectangle_area()

static float p_rectangle_area ( float p1,
float dir,
float p2,
float p3,
float p4 
)
static

Definition at line 3658 of file uvedit_parametrizer.c.

References corner1, corner2, len_v2v2(), and p_intersect_line_2d_dir().

Referenced by p_chart_minimum_area_angle().

◆ p_smooth()

static void p_smooth ( PChart chart)
static

◆ p_smooth_distortion()

static float p_smooth_distortion ( PEdge e,
float  avg2d,
float  avg3d 
)
static

Definition at line 4026 of file uvedit_parametrizer.c.

References e, p_edge_length(), and p_edge_uv_length().

Referenced by p_smooth().

◆ p_smooth_median_edge_length()

static float p_smooth_median_edge_length ( PChart chart)
static

◆ p_split_charts()

static PChart** p_split_charts ( PHandle handle,
PChart chart,
int  ncharts 
)
static

◆ p_split_vert()

static void p_split_vert ( PChart chart,
PEdge e 
)
static

◆ p_stretch_compute_vertex()

static float p_stretch_compute_vertex ( PVert v)
static

Definition at line 3487 of file uvedit_parametrizer.c.

References e, p_face_stretch(), p_wheel_edge_next(), sum(), and v.

Referenced by p_chart_stretch_minimize().

◆ p_stretch_pin_boundary()

static void p_stretch_pin_boundary ( PChart chart)
static

Definition at line 3418 of file uvedit_parametrizer.c.

References NULL, PVERT_PIN, v, and PChart::verts.

Referenced by param_stretch_begin().

◆ p_triangle_angles()

static void p_triangle_angles ( const float  v1[3],
const float  v2[3],
const float  v3[3],
float r_a1,
float r_a2,
float r_a3 
)
static

Definition at line 385 of file uvedit_parametrizer.c.

References float(), M_PI, p_vec_angle(), v1, and v2.

Referenced by p_face_angles().

◆ p_triangle_inside()

static PBool p_triangle_inside ( SmoothTriangle t,
float  co[2] 
)
static

Definition at line 3883 of file uvedit_parametrizer.c.

References p_barycentric_2d(), P_FALSE, P_TRUE, and t.

Referenced by p_node_intersect().

◆ p_vec2_angle()

static float p_vec2_angle ( const float  v1[2],
const float  v2[2],
const float  v3[2] 
)
static

Definition at line 368 of file uvedit_parametrizer.c.

References p_vec_angle(), u1, u2, v1, and v2.

Referenced by p_chart_minimum_area_angle().

◆ p_vec_angle()

static float p_vec_angle ( const float  v1[3],
const float  v2[3],
const float  v3[3] 
)
static

Definition at line 355 of file uvedit_parametrizer.c.

References acosf, M_PI, p_vec_angle_cos(), v1, and v2.

Referenced by p_edge_boundary_angle(), p_triangle_angles(), and p_vec2_angle().

◆ p_vec_angle_cos()

static float p_vec_angle_cos ( const float  v1[3],
const float  v2[3],
const float  v3[3] 
)
static

Definition at line 337 of file uvedit_parametrizer.c.

References normalize_v3(), v1, and v2.

Referenced by p_vec_angle().

◆ p_vert_add()

static PVert* p_vert_add ( PHandle handle,
PHashKey  key,
const float  co[3],
PEdge e 
)
static

◆ p_vert_copy()

static PVert* p_vert_copy ( PChart chart,
PVert v 
)
static

◆ p_vert_interior()

static PBool p_vert_interior ( PVert v)
static

Definition at line 604 of file uvedit_parametrizer.c.

References NULL, and v.

Referenced by p_chart_abf_solve().

◆ p_vert_load_pin_select_uvs()

static void p_vert_load_pin_select_uvs ( PHandle handle,
PVert v 
)
static

◆ p_vert_lookup()

static PVert* p_vert_lookup ( PHandle handle,
PHashKey  key,
const float  co[3],
PEdge e 
)
static

Definition at line 782 of file uvedit_parametrizer.c.

References e, PHandle::hash_verts, p_vert_add(), phash_lookup(), and v.

Referenced by p_face_add_construct().

◆ p_wheel_edge_next()

static PEdge* p_wheel_edge_next ( PEdge e)
static

◆ p_wheel_edge_prev()

static PEdge* p_wheel_edge_prev ( PEdge e)
static

Definition at line 582 of file uvedit_parametrizer.c.

References e, and NULL.

Referenced by p_split_vert().

◆ param_aspect_ratio()

void param_aspect_ratio ( ParamHandle handle,
float  aspx,
float  aspy 
)

◆ param_average()

void param_average ( ParamHandle handle,
bool  ignore_pinned 
)

◆ param_construct_begin()

ParamHandle* param_construct_begin ( void  )

◆ param_construct_end()

void param_construct_end ( ParamHandle handle,
ParamBool  fill,
ParamBool  topology_from_uvs,
int *  count_fail 
)

◆ param_delete()

void param_delete ( ParamHandle handle)

◆ param_edge_set_seam()

void param_edge_set_seam ( ParamHandle handle,
ParamKey vkeys 
)

◆ param_face_add()

void param_face_add ( ParamHandle handle,
ParamKey  key,
int  nverts,
ParamKey vkeys,
float co[4],
float uv[4],
ParamBool pin,
ParamBool select 
)

◆ param_flush()

void param_flush ( ParamHandle handle)

◆ param_flush_restore()

void param_flush_restore ( ParamHandle handle)

◆ param_lscm_begin()

void param_lscm_begin ( ParamHandle handle,
ParamBool  live,
ParamBool  abf 
)

◆ param_lscm_end()

void param_lscm_end ( ParamHandle handle)

◆ param_lscm_solve()

void param_lscm_solve ( ParamHandle handle,
int *  count_changed,
int *  count_failed 
)

◆ param_pack()

void param_pack ( ParamHandle handle,
float  margin,
bool  do_rotate,
bool  ignore_pinned 
)

◆ param_pack_rotate()

static void param_pack_rotate ( ParamHandle handle,
bool  ignore_pinned 
)
static

◆ param_scale()

void param_scale ( ParamHandle handle,
float  x,
float  y 
)

Definition at line 4949 of file uvedit_parametrizer.c.

References PHandle::charts, PHandle::ncharts, p_chart_uv_scale_xy(), x, and y.

Referenced by param_pack().

◆ param_smooth_area()

void param_smooth_area ( ParamHandle handle)

◆ param_stretch_begin()

void param_stretch_begin ( ParamHandle handle)

◆ param_stretch_blend()

void param_stretch_blend ( ParamHandle handle,
float  blend 
)

◆ param_stretch_end()

void param_stretch_end ( ParamHandle handle)

◆ param_stretch_iter()

void param_stretch_iter ( ParamHandle handle)

◆ phash_delete()

static void phash_delete ( PHash ph)
static

Definition at line 255 of file uvedit_parametrizer.c.

References PHash::buckets, and MEM_freeN.

Referenced by param_construct_end(), and param_delete().

◆ phash_insert()

static void phash_insert ( PHash ph,
PHashLink link 
)
static

◆ phash_lookup()

static PHashLink* phash_lookup ( PHash ph,
PHashKey  key 
)
static

◆ phash_new()

static PHash* phash_new ( PHashLink **  list,
int  sizehint 
)
static

◆ phash_next()

static PHashLink* phash_next ( PHash ph,
PHashKey  key,
PHashLink link 
)
static

Definition at line 319 of file uvedit_parametrizer.c.

References hash, PHashLink::key, PHashLink::next, NULL, and PHASH_hash.

Referenced by p_edge_has_pair(), p_edge_lookup(), and p_face_exists().

◆ phash_size()

static int phash_size ( PHash ph)
static

Definition at line 261 of file uvedit_parametrizer.c.

References PHash::size.

Referenced by p_connect_pairs().

Variable Documentation

◆ PHashSizes

int PHashSizes[]
static
Initial value:
= {
1, 3, 5, 11, 17, 37, 67, 131, 257, 521,
1031, 2053, 4099, 8209, 16411, 32771, 65537, 131101, 262147, 524309,
1048583, 2097169, 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459,
}

Definition at line 229 of file uvedit_parametrizer.c.

Referenced by phash_insert(), and phash_new().