FlatRedBall.Math.Geometry.Polygon.OptimizeRadius

Introduction The OptimizeRadius method can be called to adjust the relative points of a Polygon to reduce its radius. The radius of a polygon is used internally to improve the performance of collision methods. Usage The OptimizeRadius method should be called if a Polygon’s points are set or changed. This method will adjust the values[…]

FlatRedBall.Math.Geometry.Segment.ClosestPointTo

Introduction The ClosestPointTo returns the closest point on the calling Segment to the argument position. The closest point may be anywhere on the segment including the endpoints. Code Example The following creates a Segment and a Line as a visible representation of the Segment. The update method finds the closest point on the Segment to[…]

FlatRedBall.Math.Geometry.Polygon.Points

Introduction The Points property is an array of Point values which contain the position of each point on the polygon. These values are in “object space”. In other words, they are relative to the containing Polygon’s position and rotation values. The Points property can be assigned – this essentially changes the shape of the Polygon.[…]

FlatRedBall.Math.Geometry.Segment

Introduction A segment is a object defined by two Points. It is not a PositionedObject and its points are absolute, which differentiates it from the Line class. Segment Intersection The following code creates two Lines. One line rotates automatically while the other is controlled by input from the Keyboard. The two Lines call the AsSegment[…]

Polygon

Introduction The Polygon class is used to draw line polygons (as opposed to solid colored or textured polygons) as well as for 2D collisions. This wiki entry will cover common usage of the Polygon class. The Polygon class sits in the FlatRedBall.Math.Geometry namespace, so adding using FlatRedBall.Math.Geometry; can reduce the amount of required code. Also,[…]