
|
The above image and video was the result of the code shown on this page. Opacity, location, size and orientation can be modified through the API. The points can be rendered as points or as Glyphs. In the above image the points have been rendered as cone glyphs. |
|
Points |
|
#include "math.h" #include "..\..\nzrClient\nzrClient.h"
#define NUMBER_OF_POINTS 4000
int main(int argc, char* argv[]) { nzrClient *myNZRClient; nzr_points *pPointLocations; nzr_camera *pMyCamera; nzr_point inputArray[NUMBER_OF_POINTS]; nzr_point *pArray;
// NZR should already be running with SC window active // establish the connection with NZR myNZRClient = new nzrClient(0);
// Clear out all objects in the NZR screen myNZRClient->clearAll();
pPointLocations = new nzr_points; myNZRClient->newObject(pPointLocations); // set default values
// set data parameters for the object pPointLocations->glyphScale = 0.02; pPointLocations->glyphType = CONE; myNZRClient->createObject(pPointLocations); float alpha = 10.0; float beta = 0.02;
pPointLocations->sizeOfData=0; pArray = &inputArray[0]; for( int t = 0; t < NUMBER_OF_POINTS; t++) { pArray = &inputArray[t]; pArray->x = (float) 2.0*alpha*sin((float)t/10.0); pArray->y = (float) 2.0*alpha*cos((float)t/10.0); pArray->z = (float) beta*t; // z value pArray->intensity = (float)1*(t%10); pPointLocations->sizeOfData++; } pArray = &inputArray[0]; // restore the pointer for use again
myNZRClient->writeObject(pPointLocations, (void *) pArray);
pMyCamera = new nzr_camera; myNZRClient->newObject(pMyCamera); // set default values pMyCamera->FocalPointX = 0; pMyCamera->FocalPointY = 0; pMyCamera->FocalPointZ = 0; pMyCamera->posX = 0; pMyCamera->posY = 0; pMyCamera->posZ = 282; pMyCamera->ClippingNear = 1; pMyCamera->ClippingFar = 786; myNZRClient->setCamera(pMyCamera); // set camera parameter
// render the point data on NZR display myNZRClient->render();
return 0; }
|