fixed_convex_hull_relaxation
Constants
- RETRY_MAX_COUNT :
number
Will throw an error after not being able to collapse an edge for this many cycles
Functions
- compute_collapse_target(output, output_offset, edge, vertex_buffer) ⇒
boolean
- build_edges(point_offset, point_count) ⇒
Array.<Edge>
- collapse_edge(edge, vertex_buffer, new_vertex_index)
- compute_collapse_cost(edge, vertex_buffer)
- fixed_convex_hull_relaxation(output, output_offset, output_point_count, input_points, input_point_count) ⇒
number
Relaxes existing convex hull by removing edges until desired cardinality of the hull is reached The algorithm reaches the similar solution as the one proposed by humus, but arrives at a solution much faster as it doesn't need to consider every combination of edges The algorithm is greedy, and thus it can lead to suboptimal cuts, especially on lower number of output vertices
RETRY_MAX_COUNT : number
Will throw an error after not being able to collapse an edge for this many cycles
Kind: global constant
Read only: true
compute_collapse_target(output, output_offset, edge, vertex_buffer) ⇒ boolean
Kind: global function
Param | Type |
---|---|
output | Array.<number> | Float32Array | Float64Array |
output_offset | number |
edge | Edge |
vertex_buffer | Array.<number> |
build_edges(point_offset, point_count) ⇒ Array.<Edge>
Kind: global function
Param | Type |
---|---|
point_offset | number |
point_count | number |
build_edges~edges : Array.<Edge>
Kind: inner constant of build_edges
collapse_edge(edge, vertex_buffer, new_vertex_index)
Kind: global function
Param | Type |
---|---|
edge | Edge |
vertex_buffer | Array.<number> | Float32Array | Float64Array |
new_vertex_index | number |
compute_collapse_cost(edge, vertex_buffer)
Kind: global function
Param | Type |
---|---|
edge | Edge |
vertex_buffer | Array.<number> | Float64Array | Float32Array |
fixed_convex_hull_relaxation(output, output_offset, output_point_count, input_points, input_point_count) ⇒ number
Relaxes existing convex hull by removing edges until desired cardinality of the hull is reached The algorithm reaches the similar solution as the one proposed by humus, but arrives at a solution much faster as it doesn't need to consider every combination of edges The algorithm is greedy, and thus it can lead to suboptimal cuts, especially on lower number of output vertices
Kind: global function
Returns: number
- actual number of points, this can be lower because input polygon has too few points
Copyright: Alex Goldring 2022
Param | Type | Description |
---|---|---|
output | Array.<number> | Float32Array | result will be written here |
output_offset | number | offset into output array where to write the result |
output_point_count | number | number of points to comprise bounding polygon |
input_points | Array.<number> | Points to be bounded, must be an ordered loop |
input_point_count | number | number of points in the input to consider |
- fixed_convex_hull_relaxation(output, output_offset, output_point_count, input_points, input_point_count) ⇒
number
- ~point_buffer_cursor :
number
- ~point_buffer :
Float64Array
- ~point_buffer_cursor :
fixed_convex_hull_relaxation~point_buffer_cursor : number
Offset into point buffer
Kind: inner property of fixed_convex_hull_relaxation
fixed_convex_hull_relaxation~point_buffer : Float64Array
Point buffer will be twice as large as the input to have enough space for collapsing all the edges and recording new unique vertices produced
Kind: inner constant of fixed_convex_hull_relaxation