geo/shapes::geo #
enum Color #
Ways to paint.
variant Red #
Red = 1Warm.
variant Green #
GreenCalm.
variant Blue #
Blue = 7Cool.
struct Point #
A point in the plane.
Points are values: copy them freely.
field x #
double x = 0Across.
field y #
double y = 0Up.
method norm #
double How far from the origin.
class Shape #
Anything with an area, see Circle.
Derive from it and implement area().
constructor Shape #
explicit
Makes one at center.
method ~Shape #
virtual ~method area #
virtual double The area.
Returns
The area, in square units.
method paint #
void void Paints it.
Parameters
- color
The color.
- times
How many coats.
field count #
static unsigned long How many there are.
class Circle #
A round shape.
constructor Circle #
Makes one.
Parameters
- center
Where.
- radius
How big.
Raises
invalid_argumentIf
radiusis negative.
method area #
double The area.
Returns
The area, in square units.
method radius #
double The radius.
function largest #
It Deprecated
Use largest_of instead.
The largest of some shapes.
Parameters
- first
The first.
- last
Past the last.
Type parameters
- It
An iterator over shape pointers.
Returns
The largest, or
lastif there are none.
struct List #
A list of things.
field items #
T *The things.
field size #
unsigned long How many.
type alias Registry #
using Registry = List<Shape *>Shapes, by pointer.
struct Sides #
How many sides a regular shape has.
constant value #
static constexpr int value = NThe number.
constant pi #
constexpr double pi = 3.14159265358979The circle's constant.