Interface to Alias clouds.
#include <AlCloud.h>
class AlCloud : public AlObject
enum Subset
{
kSubsetInside,
kSubsetOutside,
kSubsetBoth
};
AlCloud();
virtual ~AlCloud();
virtual AlObjectType type() const;
virtual AlObject * copyWrapper() const;
virtual statusCode deleteObject();
statusCode create();
virtual const char* name() const;
virtual statusCode setName( const char* );
boolean visible();
statusCode setVisibility( boolean );
statusCode translation( double&, double&, double& );
statusCode setTranslation( double, double, double );
statusCode rotation( double&, double&, double& );
statusCode setRotation( double, double, double );
statusCode scale( double&, double&, double& );
statusCode setScale( double, double, double );
statusCode boundingBox( double&, double&, double&, double&, double&, double& );
statusCode subset( Subset, AlCloud **, double, double, double, double, double, double );
statusCode merge( AlCloud * );
int numberOfPoints() const;
statusCode points( int, float[] );
statusCode addPoints(double, double, double, double, double, double, int, float[] );
statusCode pick();
statusCode unpick();
boolean isPicked();
AlCloud * nextCloud() const;
statusCode nextCloudD( AlCloud * ) const;
The AlCloud API is the interface to clouds and their data. You can do operations on clouds of points such as: creating, naming, picking, or merging them; controlling their visibility; setting their transformations; subsetting a cloud of points; or adding points to an existing cloud. You can also access most cloud settings, such as the current translation, scale or pick state.
You can also:
See the descriptions below for information on how to set up the data structures for these methods.
A cloud will not be an item on the Alias pick list. (You must use AlCloud pick methods rather than AlPickList methods.)
To add arbitrary points to a cloud, you must create a cloud with the new points and then merge it into the cloud that you want to expand. The new cloud is deleted once it is merged. The new extended cloud has the outer bounding box of the two clouds.
AlUniverse::importCloudFile() has a parameter which controls the sampling factor when the cloud file is imported.
statusCode AlCloud::translation( double &x, double &y, double &z )
statusCode AlCloud::setTranslation( double x, double y, double z )
statusCode AlCloud::rotation( double &x, double &y, double &z )
statusCode AlCloud::scale( double &x, double &y, double &z )
statusCode AlCloud::boundingBox( double &minX, double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )
Returns the bounding box of the cloud of points. The bounding box corners are determined by combinations of the min and max values: (minX,minY,minZ), (minX,minY,maxZ), (minX,maxY,minZ), (minX,maxY,minZ) and so on.
statusCode AlCloud::subset( Subset partToKeep, AlCloud **newCloud, double minX, double minY, double minZ, double maxX, double maxY, double maxZ )
Subsets a cloud of points based on which part to keep and the bounding box min and max value parameters. When both parts of the subsetted cloud are kept, the part outside the bounding box is returned as the newCloud variable. newCloud may be NULL.
Note: calling subset(kSubsetBoth, ... ) has side effects on the cloud link list that is retrieved from the AlUniverse class. This same link list is also used by the AlUniverse::applyIteratorsToClouds() method. In the kSubsetBoth case, when the method is successfully completed the original cloud is deleted and two new clouds are created. Note that when you walk the cloud list yourself or use an iterator, your code will fail if it tries to advance from the cloud that was just deleted.
If this method fails, it may be the case that the cloud was deleted.
< partToKeep - one of kSubsetInside, kSubsetOutside or kSubsetBoth
> newCloud - cloud created outside of the bounding box when kSubsetBoth is used; could be a NULL parameter
< minX - minimum x of cloud subset bounding box
< minY - minimum y of cloud subset bounding box
< minZ - minimum z of cloud subset bounding box
< maxX - maximum x of cloud subset bounding box
< maxY - maximum y of cloud subset bounding box
< maxZ - maximum z of cloud subset bounding box
statusCode AlCloud::points(int numberOfPoints, float pointArray[] )
Provides access to the list of points within a cloud. Because a point consists of 3 floats, a cloud with 10 points would require a pointArray of size 30 to retrieve all points of the cloud. To access the points within the array, use the following code:
Example code: int num = cloud->numberOfPoints(); float *points = (float *) malloc( sizeof(float) * num * 3 ); if ( points == NULL ) return; if ( cloud->points( num, points ) != sSuccess ) return; float *pt = points; for ( int i = 0 ; i < num ; i++ ) { pt[0] += x; pt[1] += y; pt[2] += z; pt += 3; }
Note: numberOfPoints can be less than the actual number of points. The method will place as many points as possible into the array and then return successfully.
statusCode AlCloud::addPoints( double minX, double minY, double minZ, double maxX, double maxY, double maxZ, int numberOfPoints, float points[] )
Adds points within a min and max bounding box to a cloud. This method only works on a cloud that has no points and extents of zero. Any point in the points[ ] array outside of the specified min and max extents is skipped.
Note: as in the points() method, the points parameter is a float[ 3 * numberOfPoints ] array.
< minX - minimum x of cloud bounding box
< minY - minimum y of cloud bounding box
< minZ - minimum z of cloud bounding box
< maxX - maximum x of cloud bounding box
< maxY - maximum y of cloud bounding box
< maxZ - maximum z of cloud bounding box
< numberOfPoints - number of points in the point array. Each point is 3 doubles. (This is not the same as array size.)
< points - the point array
statusCode AlCloud::nextCloudD( AlCloud *currentCloud ) const