HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Properties | List of all members
Box2D.Hull Struct Reference

A convex hull. Used to create convex polygons. More...

Public Member Functions

 Hull (Span< Vec2 > points)
 Computes a hull from a set of points. This is a copy constructor.
 

Static Public Member Functions

static unsafe Hull Compute (ReadOnlySpan< Vec2 > points)
 Compute the convex hull of a set of points. Returns an empty hull if it fails. Some failure cases:
 

Properties

unsafe ReadOnlySpan< Vec2 > Points [get]
 The final points of the hull.
 
bool Valid [get]
 Determines if this hull is valid. Checks for:
 

Detailed Description

A convex hull. Used to create convex polygons.

Warning: Do not modify these values directly, instead use Hull.Compute(System.Span<System.Numerics.Vector2>)

Constructor & Destructor Documentation

◆ Hull()

Box2D.Hull.Hull ( Span< Vec2 >  points)
inline

Computes a hull from a set of points. This is a copy constructor.

Parameters
pointsThe points to compute the hull from

This is a copy constructor. The hull will be computed and stored in this instance.

Member Function Documentation

◆ Compute()

static unsafe Hull Box2D.Hull.Compute ( ReadOnlySpan< Vec2 >  points)
inlinestatic

Compute the convex hull of a set of points. Returns an empty hull if it fails. Some failure cases:

  • all points very close together
  • all points on a line
  • less than 3 points
  • more than B2_MAX_POLYGON_VERTICES points

This welds close points and removes collinear points.

Warning: Do not modify a hull once it has been computed

Property Documentation

◆ Valid

bool Box2D.Hull.Valid
get

Determines if this hull is valid. Checks for:

  • convexity
  • collinear points

This is expensive and should not be called at runtime.


The documentation for this struct was generated from the following file: