class AstFract: public Ast

This class represent a asteroid with a random silohuette

Inheritance:


Public Fields

[more] P
The polygon representing the asteroid silohuette

Public Methods

[more] AstFract()
Default constructor
[more] AstFract(const Point3f &_p, const float _angle, const Point3f &_v, float _av, float _size)
Specialized constructor to set also angular velocity and size
[more]void Draw()
Draw the asteroid shape
[more]void Build(int SplitNum=2)
Build the fractal silouhette of the asteroid
[more]void Split(list<Point3f> &p)
Get a polygon represented as a list of n point3f and returns a polygon with 2n sides and 2n vertices

Documentation

This class represent a asteroid with a random silohuette. It is derived from the Ast Class. The generation of the random silohuette is done in the member function Build, that is called by all the constructors. The random silohuette is stored in a vector<Point3f>.
o P
The polygon representing the asteroid silohuette.

o AstFract()
Default constructor. It should also start the build function to create the random silohuette;

o AstFract(const Point3f &_p, const float _angle, const Point3f &_v, float _av, float _size)
Specialized constructor to set also angular velocity and size. It should also start the build function to create the random silohuette;

ovoid Draw()
Draw the asteroid shape. Simply draw the polygon stored in P

ovoid Build(int SplitNum=2)
Build the fractal silouhette of the asteroid. Build an initial triangle and then split each side the given number of times. The result is stored in the vector P.

ovoid Split(list<Point3f> &p)
Get a polygon represented as a list of n point3f and returns a polygon with 2n sides and 2n vertices.

The position of each new vertex is calculated as follows: Given two points p1 p2 and the barycenter of poligon cm:

  • Find the bisector b of the angle p1 cm p2,
  • find the new point np on b at a distance that is the average of dist(p1,cm) and dist(p2,cm)
  • perturb np of a small quantity depending on dist(p1,p2)


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.