Skip to main content

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

ParamType
outputArray.<number> | Float32Array | Float64Array
output_offsetnumber
edgeEdge
vertex_bufferArray.<number>

build_edges(point_offset, point_count) ⇒ Array.<Edge>

Kind: global function

ParamType
point_offsetnumber
point_countnumber

build_edges~edges : Array.<Edge>

Kind: inner constant of build_edges

collapse_edge(edge, vertex_buffer, new_vertex_index)

Kind: global function

ParamType
edgeEdge
vertex_bufferArray.<number> | Float32Array | Float64Array
new_vertex_indexnumber

compute_collapse_cost(edge, vertex_buffer)

Kind: global function

ParamType
edgeEdge
vertex_bufferArray.<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

ParamTypeDescription
outputArray.<number> | Float32Arrayresult will be written here
output_offsetnumberoffset into output array where to write the result
output_point_countnumbernumber of points to comprise bounding polygon
input_pointsArray.<number>Points to be bounded, must be an ordered loop
input_point_countnumbernumber of points in the input to consider

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