Table of contents |
Derived from: BArchivable
Declared in: MTPoints.h
Library: 3DM.so
This class contains a list of points, and the methods to transform them. The points' 3 coordinates (X, Y and Z) are stored, with their colors.
|
Construct a new object. The first version builds an empty list, the second one can be used to recreate a list from an archive.
You can also build a MTPoints object with 6 vectors ( MTVector objects). The first 3 vectors (x, y and z) are the points coordinates, between -1 and 1 usually, and the 3 last ones (r, g and b) are the colors, between 0 and 1. The vectors must all have exactly the same size. If they don't, the MTPoints object will be empty.
The last constructor builds a MTPoints object from an array of floats and of rgb_colors. coordinates contains nPoints*3 floats. You must first put in the array the coordinates of the first point, then the coordinates of the second one, etc... This constructor is useful if you want to build an object without using the MTVector class.
|
Destroys the list
|
Creates a white circle, with nPoints points, centered at (0,0,0), radius 1, in the x-y plane.
|
Creates a new list extracted from the given archive. It must have been made with Archive() .
|
Creates a new object, morphing between p1 and p2. f controls the morphing. If f is 0, p1 is returned. If f is 1, p2 is returned. If f is between 0 and 1, a morphing between p1 and p2 is done. You can try values below 0 or after 1, and you can have interesting results...
|
Creates a new white segment, with nPoints points. You can change the colors with SetColor() .
|
Stores the points list in the given archive. You can build a new list from this archive with the apporpirate constructor, or by using the Instantiate() static function.
|
Adds to the current list the points given as vectors (x, y, z, r, g and b) or as another MTPoints object (points).
|
Returns the color list currently used in the object (one rgb_color per point).
|
Returns the coordinates list (3 floats per point: X, Y and Z, in this order).
|
Returns the number of points in the object.
|
Projects the 3D Points on a 2D plane. The plane used is a x-y plane at z=0. depth is the distance between the plane and the projection point.
The given proj array of BPoint objectss must be allocated, and big enough. (You can know the number of points with NumPoints() .
This method returns proj.
|
Changes the color list of the object. The first version takes the colors - and only the colors - from the object src. The two objects must have the same number of points. The second one takes the colors from 3 MTVector objects. The vectors must have the right length. SetColor() returns true if the colors could be changed, and false if not (if src or r, g and b don't have the right length).
The next two versions take one color and apply it to all the points. They always return true. The last two versions make a gradient between the two given colors. They also return true.
When you use MTVector objects or floats, you must use values between 0 and 1 to represent the colors.
|
Changes the coordinates of the points in the object, without changing the colors. The coordinates can be taken from another MTObject , or from 3 MTVector objects. Usually the coordinates are between -1 and 1. Returns true if the change could be done, and false if not (if the lengths of src, or x y and z don't have the right size).
|
Replaces the object by a new list. It can be a copy of src, or a new list made with the coordinates stored in the vectors x, y and z (between -1 and 1, usually) and the colors stored in the vectors r, g and b (between 0 and 1 usually).
The last version builds a MTPoints object from an array of floats and of rgb_colors. coordinates contains nPoints*3 floats. You must first put in the array the 3 coordinates of the first point, then the coordinates of the second one, etc... This version is useful if you want to build an object without using the MTVector class.
|
Apply a linear transformation to the points stored in the object. Have a look at MTMatrix for more details about matrices.
|
Copies the src list in the current object.
|
Creates a new list that contains the points in the current list, and then those in pts. The current object isn't modified. Thus in:
A = B & C
A contains all the points in B and in C. B and C aren't modified.
|
Adds the points pts to the current list.
See Add() .
|
Creates a new list with the points of the current object, transformed with the MTMatrix matrix. The current object isn't modified.
|
Transform the points stored in the object with the given matrix.
See Transform() .