struct
Tessell::Render::Polygon
- Tessell::Render::Polygon
- Struct
- Value
- Object
Defined in:
tessell/render/polygon.crConstructors
-
.new(points : Array(Tessell::Point))
Holds the caller's array reference (no copy).
Class Method Summary
-
.emit_fan(points : Array(Tessell::Point), sink : Slice(Float32)) : Int32
Emits a triangle fan from points[0] as explicit triangles in fan order: (p0,p1,p2), (p0,p2,p3), ...
-
.mask(points : Array(Tessell::Point), bounds : Tessell::Rect, sink : Bytes) : Int32
Writes w*h bytes (0/1 coverage) into caller-preallocated sink for bounds, sampling pixel centers at (bounds.x + x + 0.5, bounds.y + y + 0.5).
Instance Method Summary
- #bounds : Tessell::Rect
-
#contains?(p : Tessell::Point) : Bool
Even-odd ray casting: a horizontal ray from p toward +x crosses an edge when (y0 > p.y) != (y1 > p.y) (so edges with y0 == y1 do not cross) and p.x is strictly less than the edge's x at p.y.
- #points : Array(Tessell::Point)
- #signed_area : Float32
- #size : Int32
Constructor Detail
Class Method Detail
Emits a triangle fan from points[0] as explicit triangles in fan order: (p0,p1,p2), (p0,p2,p3), ... writing x,y for each vertex into sink. Total floats = 6*(n-2). Returns triangle count (n-2). Raises if sink small.
Writes w*h bytes (0/1 coverage) into caller-preallocated sink for bounds, sampling pixel centers at (bounds.x + x + 0.5, bounds.y + y + 0.5). Returns covered pixel count. Raises ArgumentError if sink is too small.
Instance Method Detail
Even-odd ray casting: a horizontal ray from p toward +x crosses an edge when (y0 > p.y) != (y1 > p.y) (so edges with y0 == y1 do not cross) and p.x is strictly less than the edge's x at p.y. Boundary/on-edge points: classification follows these strict comparisons and is not guaranteed to be treated as inside (edge cases may return false).