Improve tessellation algorithm

Added new mesh class
Rewrite mesh algorithms to be less error prone
Make code more concise
Tried to add some documentation
Added half edge set
This commit is contained in:
2025-05-03 23:52:54 -04:00
parent a1899a52b7
commit d16041f977
30 changed files with 2923 additions and 227 deletions

View File

@@ -0,0 +1,31 @@
package com.aaaaahhhhhhh.bananapuncher714.mesh;
import java.util.List;
/**
* A list of points denoting the shape of the polygon. May contain self intersections,
* duplicate vertices, and overlapping edges.
*
* @author BananaPuncher714
*/
public class Polygon {
protected List< Point > points;
public Polygon( List< Point > points ) {
this.points = points;
}
public List< Point > getPoints() {
return points;
}
public double area() {
double area = 0;
for ( int i = 0; i < points.size(); ++i ) {
final Vector2d a = new Vector2d( points.get( i ) );
final Vector2d b = new Vector2d( points.get( ( i + 1 ) % points.size() ) );
area += a.cross( b );
}
return Math.abs( area ) / 2.0;
}
}