[][src]Crate duckduckgeo

Provides some useful 2d geometry functions.

Why the name? Not sure. Duck Duck Goose.

Structs

ErrTooClose

If we repel too close, because of the inverse square we might get overlow problems.

Ray

A Ray.

Enums

IntersectsBotResult

Describes if a ray hit a rectangle.

WallSide

Describes a cardinal direction..

Traits

GravityTrait

Passed to gravitate.

RepelTrait

Passed to repel

Functions

collide_with_rect

Returns which cardinal direction the specified rectangle is closest to.

distance_squared_point_to_rect

If the point is outisde the rectangle, returns the squared distance from a point to a rectangle. If the point is insert the rectangle, it will return None.

distance_squred_point

Returns the squared distances between two points.

gravitate

Returns the force to be exerted to the first object. The force to the second object can be retrieved simply by negating the first.

repel

Repel two objects.

repel_one

Repel one object by simply not calling add_force on the other.

wrap_position

Wraps the first point around the rectangle made between (0,0) and dim.