Skip to content

Commit

Permalink
Polygon - update to v1.4
Browse files Browse the repository at this point in the history
update Polygon to v1.4

adds:
- vertex color, and tex-coords
- bounds (local and global)
- texture (used by tex-coords if set, ignored if not set; always ignored by wireframe)
- ability to provide points in a reverses direction (i.e. clockwise for outer and anti-clockwise for holes - instead of anti-clockwise for outer and clockwise for holes)
- ability to get perimeter of polygon (length of all edges; include hole edges)
- ability to get area of polygon (after triangulation)
- ability to get if point is inside polygon (after triangulation)
- ability to get centroid (average of all outer's points; doesn't include hole vertices)
- ability to get centre of mass (actual centre of mass; based on triangles' areas)
- ability to get and set (existing) hole start indices/number of holes
- export vertex positions (the actual vertices forming the polygon boundary, in order)
- export vertex positions for only the outer boundary (does not include hole vertices)
- export vertex positions for only the given hole (vertices for the hole)
- export wireframe position (in pairs for each separate line)
- constructors (from other Polygon or initializer list of positions) and operator= (from other Polygon)
- operator[] to provide direct access to vertices (no validity checking). note that these are the vertices of the polygon "blueprint" - the thing you provide - not the actual vertices used to draw the shape.

also fixed:
- draw() signature: removed "virtual", added "override final" (just code-style update)
- now tests exception flag before throwing error in trangulation; also moved exception flag into cpp. note that this flag is always set to true.
  • Loading branch information
Hapaxia committed Feb 15, 2024
1 parent d904450 commit 27efc13
Show file tree
Hide file tree
Showing 2 changed files with 378 additions and 22 deletions.
Loading

0 comments on commit 27efc13

Please sign in to comment.