Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions | Variables
uv_parametrizer.c File Reference
#include "GEO_uv_parametrizer.h"
#include "MEM_guardedalloc.h"
#include "BLI_boxpack_2d.h"
#include "BLI_convexhull_2d.h"
#include "BLI_ghash.h"
#include "BLI_heap.h"
#include "BLI_memarena.h"
#include "BLI_polyfill_2d.h"
#include "BLI_polyfill_2d_beautify.h"
#include "BLI_rand.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  ParamHandle
 
struct  PAbfSystem
 
struct  GeoUVPinIndex
 

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 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 ParamHandle ParamHandle
 
typedef struct PAbfSystem PAbfSystem
 
typedef struct GeoUVPinIndex GeoUVPinIndex
 

Enumerations

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 (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 bool 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 bool p_vert_interior (PVert *v)
 
static void p_face_flip (PFace *f)
 
static void p_vert_load_pin_select_uvs (ParamHandle *handle, PVert *v)
 
static void p_flush_uvs (ParamHandle *handle, PChart *chart)
 
static void p_flush_uvs_blend (ParamHandle *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 (ParamHandle *handle, PHashKey key, const float co[3], PEdge *e)
 
static PVertp_vert_lookup (ParamHandle *handle, PHashKey key, const float co[3], PEdge *e)
 
static PVertp_vert_copy (PChart *chart, PVert *v)
 
static PEdgep_edge_lookup (ParamHandle *handle, const PHashKey *vkeys)
 
static int p_face_exists (ParamHandle *handle, const ParamKey *pvkeys, int i1, int i2, int i3)
 
static PChartp_chart_new (ParamHandle *handle)
 
static void p_chart_delete (PChart *chart)
 
static bool p_edge_implicit_seam (PEdge *e, PEdge *ep)
 
static bool p_edge_has_pair (ParamHandle *handle, PEdge *e, bool topology_from_uvs, PEdge **r_pair)
 
static bool p_edge_connect_pair (ParamHandle *handle, PEdge *e, bool topology_from_uvs, PEdge ***stack)
 
static int p_connect_pairs (ParamHandle *handle, bool topology_from_uvs)
 
static void p_split_vert (PChart *chart, PEdge *e)
 
static PChart ** p_split_charts (ParamHandle *handle, PChart *chart, int ncharts)
 
static PFacep_face_add (ParamHandle *handle)
 
static PFacep_face_add_construct (ParamHandle *handle, ParamKey key, const ParamKey *vkeys, const float **co, float **uv, int i1, int i2, int i3, const bool *pin, const bool *select)
 
static PFacep_face_add_fill (PChart *chart, PVert *v1, PVert *v2, PVert *v3)
 
static bool p_quad_split_direction (ParamHandle *handle, const float **co, const ParamKey *vkeys)
 
static void p_chart_boundaries (PChart *chart, 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 bool p_abf_matrix_invert (PAbfSystem *sys, PChart *chart)
 
static bool p_chart_abf_solve (PChart *chart)
 
static void p_chart_pin_positions (PChart *chart, PVert **pin1, PVert **pin2)
 
static bool 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, bool live, bool abf)
 
static bool p_chart_lscm_solve (ParamHandle *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 bool 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)
 
ParamHandleGEO_uv_parametrizer_construct_begin (void)
 
void GEO_uv_parametrizer_aspect_ratio (ParamHandle *phandle, float aspx, float aspy)
 
void GEO_uv_parametrizer_delete (ParamHandle *phandle)
 
ParamKey GEO_uv_find_pin_index (ParamHandle *handle, const int bmvertindex, const float uv[2])
 
static GeoUVPinIndexnew_geo_uv_pinindex (ParamHandle *handle, const float uv[2])
 
void GEO_uv_prepare_pin_index (ParamHandle *handle, const int bmvertindex, const float uv[2])
 
static void p_add_ngon (ParamHandle *handle, const ParamKey key, const int nverts, const ParamKey *vkeys, const float **co, float **uv, const bool *pin, const bool *select)
 
void GEO_uv_parametrizer_face_add (ParamHandle *phandle, const ParamKey key, const int nverts, const ParamKey *vkeys, const float **co, float **uv, const bool *pin, const bool *select)
 
void GEO_uv_parametrizer_edge_set_seam (ParamHandle *phandle, ParamKey *vkeys)
 
void GEO_uv_parametrizer_construct_end (ParamHandle *phandle, bool fill, bool topology_from_uvs, int *count_fail)
 
void GEO_uv_parametrizer_lscm_begin (ParamHandle *phandle, bool live, bool abf)
 
void GEO_uv_parametrizer_lscm_solve (ParamHandle *phandle, int *count_changed, int *count_failed)
 
void GEO_uv_parametrizer_lscm_end (ParamHandle *phandle)
 
void GEO_uv_parametrizer_stretch_begin (ParamHandle *phandle)
 
void GEO_uv_parametrizer_stretch_blend (ParamHandle *phandle, float blend)
 
void GEO_uv_parametrizer_stretch_iter (ParamHandle *phandle)
 
void GEO_uv_parametrizer_stretch_end (ParamHandle *phandle)
 
static void GEO_uv_parametrizer_pack_rotate (ParamHandle *phandle, bool ignore_pinned)
 
void GEO_uv_parametrizer_pack (ParamHandle *handle, float margin, bool do_rotate, bool ignore_pinned)
 
void GEO_uv_parametrizer_average (ParamHandle *phandle, bool ignore_pinned, bool scale_uv, bool shear)
 
void GEO_uv_parametrizer_scale (ParamHandle *phandle, float x, float y)
 
void GEO_uv_parametrizer_flush (ParamHandle *phandle)
 
void GEO_uv_parametrizer_flush_restore (ParamHandle *phandle)
 

Variables

static int PHashSizes []
 

Macro Definition Documentation

◆ ABF_MAX_ITER

#define ABF_MAX_ITER   20

Definition at line 2283 of file uv_parametrizer.c.

◆ P_STRETCH_ITER

#define P_STRETCH_ITER   20

Definition at line 3284 of file uv_parametrizer.c.

◆ param_assert

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

Definition at line 24 of file uv_parametrizer.c.

◆ param_warning

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

Definition at line 28 of file uv_parametrizer.c.

◆ PEDGE_VERTEX_FLAGS

#define PEDGE_VERTEX_FLAGS   (PEDGE_PIN)

Definition at line 119 of file uv_parametrizer.c.

◆ PHASH_edge

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

Definition at line 207 of file uv_parametrizer.c.

◆ PHASH_hash

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

Definition at line 206 of file uv_parametrizer.c.

Typedef Documentation

◆ GeoUVPinIndex

typedef struct GeoUVPinIndex GeoUVPinIndex

◆ PAbfSystem

typedef struct PAbfSystem PAbfSystem

◆ ParamHandle

typedef struct ParamHandle ParamHandle

◆ PChart

typedef struct PChart PChart

◆ PEdge

typedef struct PEdge PEdge

◆ PFace

typedef struct PFace PFace

◆ PHash

typedef struct PHash PHash

◆ PHashKey

typedef intptr_t PHashKey

Definition at line 33 of file uv_parametrizer.c.

◆ PHashLink

typedef struct PHashLink PHashLink

◆ PVert

typedef struct PVert PVert

Enumeration Type Documentation

◆ PChartFlag

enum PChartFlag
Enumerator
PCHART_HAS_PINS 

Definition at line 160 of file uv_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 106 of file uv_parametrizer.c.

◆ PFaceFlag

enum PFaceFlag
Enumerator
PFACE_CONNECTED 
PFACE_FILLED 
PFACE_COLLAPSE 

Definition at line 121 of file uv_parametrizer.c.

◆ PHandleState

Enumerator
PHANDLE_STATE_ALLOCATED 
PHANDLE_STATE_CONSTRUCTED 
PHANDLE_STATE_LSCM 
PHANDLE_STATE_STRETCH 

Definition at line 164 of file uv_parametrizer.c.

◆ PVertFlag

enum PVertFlag
Enumerator
PVERT_PIN 
PVERT_SELECT 
PVERT_INTERIOR 
PVERT_COLLAPSE 
PVERT_SPLIT 

Definition at line 98 of file uv_parametrizer.c.

Function Documentation

◆ GEO_uv_find_pin_index()

ParamKey GEO_uv_find_pin_index ( ParamHandle handle,
const int  bmvertindex,
const float  uv[2] 
)

◆ GEO_uv_parametrizer_aspect_ratio()

void GEO_uv_parametrizer_aspect_ratio ( ParamHandle phandle,
float  aspx,
float  aspy 
)

◆ GEO_uv_parametrizer_average()

void GEO_uv_parametrizer_average ( ParamHandle phandle,
bool  ignore_pinned,
bool  scale_uv,
bool  shear 
)

◆ GEO_uv_parametrizer_construct_begin()

ParamHandle* GEO_uv_parametrizer_construct_begin ( void  )

◆ GEO_uv_parametrizer_construct_end()

void GEO_uv_parametrizer_construct_end ( ParamHandle phandle,
bool  fill,
bool  topology_from_uvs,
int *  count_fail 
)

◆ GEO_uv_parametrizer_delete()

void GEO_uv_parametrizer_delete ( ParamHandle phandle)

◆ GEO_uv_parametrizer_edge_set_seam()

void GEO_uv_parametrizer_edge_set_seam ( ParamHandle phandle,
ParamKey vkeys 
)

◆ GEO_uv_parametrizer_face_add()

void GEO_uv_parametrizer_face_add ( ParamHandle phandle,
const ParamKey  key,
const int  nverts,
const ParamKey vkeys,
const float **  co,
float **  uv,
const bool pin,
const bool select 
)

◆ GEO_uv_parametrizer_flush()

void GEO_uv_parametrizer_flush ( ParamHandle phandle)

◆ GEO_uv_parametrizer_flush_restore()

void GEO_uv_parametrizer_flush_restore ( ParamHandle phandle)

◆ GEO_uv_parametrizer_lscm_begin()

void GEO_uv_parametrizer_lscm_begin ( ParamHandle phandle,
bool  live,
bool  abf 
)

◆ GEO_uv_parametrizer_lscm_end()

void GEO_uv_parametrizer_lscm_end ( ParamHandle phandle)

◆ GEO_uv_parametrizer_lscm_solve()

void GEO_uv_parametrizer_lscm_solve ( ParamHandle phandle,
int *  count_changed,
int *  count_failed 
)

◆ GEO_uv_parametrizer_pack()

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

◆ GEO_uv_parametrizer_pack_rotate()

static void GEO_uv_parametrizer_pack_rotate ( ParamHandle phandle,
bool  ignore_pinned 
)
static

◆ GEO_uv_parametrizer_scale()

void GEO_uv_parametrizer_scale ( ParamHandle phandle,
float  x,
float  y 
)

◆ GEO_uv_parametrizer_stretch_begin()

void GEO_uv_parametrizer_stretch_begin ( ParamHandle phandle)

◆ GEO_uv_parametrizer_stretch_blend()

void GEO_uv_parametrizer_stretch_blend ( ParamHandle phandle,
float  blend 
)

◆ GEO_uv_parametrizer_stretch_end()

void GEO_uv_parametrizer_stretch_end ( ParamHandle phandle)

◆ GEO_uv_parametrizer_stretch_iter()

void GEO_uv_parametrizer_stretch_iter ( ParamHandle phandle)

◆ GEO_uv_prepare_pin_index()

void GEO_uv_prepare_pin_index ( ParamHandle handle,
const int  bmvertindex,
const float  uv[2] 
)

◆ new_geo_uv_pinindex()

static GeoUVPinIndex* new_geo_uv_pinindex ( ParamHandle handle,
const float  uv[2] 
)
static

◆ 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 bool 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,
const ParamKey  key,
const int  nverts,
const ParamKey vkeys,
const float **  co,
float **  uv,
const bool pin,
const bool 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 340 of file uv_parametrizer.c.

References v1, and v2.

Referenced by p_chart_convex_hull().

◆ p_boundary_edge_next()

static PEdge* p_boundary_edge_next ( PEdge e)
static

Definition at line 468 of file uv_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 473 of file uv_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 bool p_chart_abf_solve ( PChart chart)
static

◆ p_chart_boundaries()

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

◆ p_chart_convex_hull()

static bool 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 738 of file uv_parametrizer.c.

References MEM_freeN.

Referenced by GEO_uv_parametrizer_construct_end(), and GEO_uv_parametrizer_delete().

◆ p_chart_extrema_verts()

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

Definition at line 2977 of file uv_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,
bool  live,
bool  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 bool p_chart_lscm_solve ( ParamHandle 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 ( ParamHandle handle)
static

Definition at line 730 of file uv_parametrizer.c.

References PChart::handle, and MEM_callocN.

Referenced by GEO_uv_parametrizer_construct_begin(), and p_split_charts().

◆ 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 3677 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_lscm_solve().

◆ p_chart_stretch_minimize()

static void p_chart_stretch_minimize ( PChart chart,
RNG rng 
)
static

◆ p_chart_symmetry_pins()

static bool 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

◆ p_chart_uv_scale()

static void p_chart_uv_scale ( PChart chart,
float  scale 
)
static

◆ p_chart_uv_scale_xy()

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

Definition at line 396 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_scale().

◆ p_chart_uv_to_array()

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

Definition at line 425 of file uv_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 416 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_average(), and p_chart_rotate_fit_aabb().

◆ p_chart_uv_translate()

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

◆ p_compare_geometric_uv()

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

Definition at line 3439 of file uv_parametrizer.c.

References Freestyle::a, usdtokens::b(), v1, and v2.

Referenced by p_chart_convex_hull().

◆ p_connect_pairs()

static int p_connect_pairs ( ParamHandle handle,
bool  topology_from_uvs 
)
static

◆ p_edge_boundary_angle()

static float p_edge_boundary_angle ( PEdge e)
static

Definition at line 1180 of file uv_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 bool p_edge_connect_pair ( ParamHandle handle,
PEdge e,
bool  topology_from_uvs,
PEdge ***  stack 
)
static

◆ p_edge_has_pair()

static bool p_edge_has_pair ( ParamHandle handle,
PEdge e,
bool  topology_from_uvs,
PEdge **  r_pair 
)
static

◆ p_edge_implicit_seam()

static bool p_edge_implicit_seam ( PEdge e,
PEdge ep 
)
static

◆ p_edge_length()

static float p_edge_length ( PEdge e)
static

Definition at line 354 of file uv_parametrizer.c.

References BMVert::co, e, and len_v3v3().

Referenced by p_chart_boundaries(), and p_chart_symmetry_pins().

◆ p_edge_lookup()

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

◆ p_edge_uv_length()

static float p_edge_uv_length ( PEdge e)
static

Definition at line 359 of file uv_parametrizer.c.

References e, and len_v2v2().

Referenced by p_chart_stretch_minimize(), and p_face_stretch().

◆ p_face_add()

static PFace* p_face_add ( ParamHandle handle)
static

◆ p_face_add_construct()

static PFace* p_face_add_construct ( ParamHandle handle,
ParamKey  key,
const ParamKey vkeys,
const float **  co,
float **  uv,
int  i1,
int  i2,
int  i3,
const bool pin,
const bool 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

◆ p_face_backup_uvs()

static void p_face_backup_uvs ( PFace f)
static

◆ p_face_exists()

static int p_face_exists ( ParamHandle handle,
const 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 620 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_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 ( ParamHandle handle,
PChart chart 
)
static

Definition at line 577 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_flush().

◆ p_flush_uvs_blend()

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

Definition at line 589 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_flush().

◆ p_intersect_line_2d_dir()

static bool 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 435 of file uv_parametrizer.c.

References v1, and v2.

Referenced by p_rectangle_area().

◆ p_quad_split_direction()

static bool p_quad_split_direction ( ParamHandle handle,
const float **  co,
const ParamKey vkeys 
)
static

Definition at line 1115 of file uv_parametrizer.c.

References len_v3v3(), and p_face_exists().

Referenced by GEO_uv_parametrizer_face_add().

◆ p_rectangle_area()

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

Definition at line 3528 of file uv_parametrizer.c.

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

Referenced by p_chart_minimum_area_angle().

◆ p_split_charts()

static PChart** p_split_charts ( ParamHandle 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 3357 of file uv_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 3286 of file uv_parametrizer.c.

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

Referenced by GEO_uv_parametrizer_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 316 of file uv_parametrizer.c.

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

Referenced by p_face_angles().

◆ p_vec2_angle()

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

Definition at line 312 of file uv_parametrizer.c.

References angle_v2v2v2(), 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 308 of file uv_parametrizer.c.

References angle_v3v3v3(), v1, and v2.

Referenced by p_edge_boundary_angle(), and p_triangle_angles().

◆ p_vert_add()

static PVert* p_vert_add ( ParamHandle 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 bool p_vert_interior ( PVert v)
static

Definition at line 485 of file uv_parametrizer.c.

References v.

Referenced by p_chart_abf_solve().

◆ p_vert_load_pin_select_uvs()

static void p_vert_load_pin_select_uvs ( ParamHandle handle,
PVert v 
)
static

◆ p_vert_lookup()

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

Definition at line 663 of file uv_parametrizer.c.

References e, ParamHandle::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 463 of file uv_parametrizer.c.

References e, and NULL.

Referenced by p_split_vert().

◆ phash_delete()

static void phash_delete ( PHash ph)
static

Definition at line 226 of file uv_parametrizer.c.

References PHash::buckets, and MEM_freeN.

Referenced by GEO_uv_parametrizer_construct_end(), and GEO_uv_parametrizer_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 290 of file uv_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 232 of file uv_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 200 of file uv_parametrizer.c.

Referenced by phash_insert(), and phash_new().