RenderMan & RISpec >> Point Cloud API

by Nicholas » Mon, 07 Jan 2008 16:56:33 GMT

Hi,

I am new to generating PTC and currently only have access to
3Delight 7.0.0

I have written the following but the viewer displays what looks like
a single point but reported it has read in 32768 points from the file.

Could someone comment if this is the way to generate PTC file? I am
hoping to create some volume rendering like renders using this
approach.

8<------8<------8<------8<------8<------8<------8<------8<------
#include <pointcloud.h>
#include <string>
#include <vector>
#include <iostream>

int main()
{
PtcPointCloud ptc;
const char *filename = "nicholas.ptc";
const int nvars = 1;
const char vartype0[] = "color";
const char *vartypes[nvars] = {vartype0};
const char varname0[] = "volcolor";
const char *varnames[nvars] = {varname0};
float world2eye[] = {1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1};
float world2ndc[] = {1,0,0,0,
0,1,0,0,
0,0,1,0,
0,0,0,1};
float format[] = {256,256,1};


ptc = PtcCreatePointCloudFile ( filename,
nvars,
vartypes,
varnames,
world2eye,
world2ndc,
format );

int writeStatus;
float point[] = {0,0,0};
float normal[] = {0,0,1};
float radius = 2;
float data[] = {1,1,1};

const size_t nWidth = 32;
const size_t nHeight = 32;
const size_t nDepth = 32;
const float volumeCubeSize = 100.0f;
const float widthDelta = volumeCubeSize / (nWidth - 1);
const float heightDelta = volumeCubeSize / (nHeight - 1);
const float depthDelta = volumeCubeSize / (nDepth - 1);
const float startWidth = -volumeCubeSize * 0.5;
const float startHeight = -volumeCubeSize * 0.5;
const float startDepth = -volumeCubeSize * 0.5;

for (size_t i = 0 ; i < nWidth ; i++)
{
for (size_t j = 0 ; j < nHeight ; j++)
{
for (size_t k = 0 ; k < nDepth ; k++)
{
float x = startWidth + i * widthDelta;
float y = startHeight + j * heightDelta;
float z = startDepth + k * depthDelta;
printf("point is [%f,%f,%f]\n",x,y,z);
point[0] = x;
point[1] = y;
point[2] = z;
writeStatus = PtcWriteDataPoint ( ptc,
point,
normal,
radius,
data );
if (writeStatus != 1)
std::cerr << "Failed to write data point" << std::endl;
}
}
}
PtcFinishPointCloudFile(ptc);
return 0;
}

Regards


Similar Threads

1. find close points in a point cloud

This is my code:

void RemoveClosePoints(double* xIso, double* yIso, int nIso, double 
maxdist)
{
 for(unsigned int i=0; i<nIso; ++i)
 {
  for(unsigned int j=i+1; j<nIso; ++j)
  {
   // if the points are closer than "maxdist"
   if(abs(xIso[i]-xIso[j])<=maxdist && abs(yIso[i]-yIso[j])<=maxdist)
   {
    // make it inaccessable in the list
    --nIso;
    xIso[j] = xIso[nIso];
    yIso[j] = yIso[nIso];
    vIso[j] = vIso[nIso];
    --i;
    break;
   }
  }
 }
}

how to make that faster?


-- 
-Gernot
int main(int argc, char** argv) {printf 
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com


2. algorithm to remoce duplicated points in a point clouds

3. cloud points rending

Hi, goodmorning.

Is someone could give me the best way to drawing a "surface":
 I have a array of 100 000 points [x, y, z] witch describe my "surface", and
a texture picture to set on [u, v].
With DirectX6, i have rending it, by using AddTriangle and
D3DRMVERTEX_STRIP. It's working very well but it was heavy (2 time more
memory and a long time to set correctly my points in the array).
I would like do it with DirectX9. I could take the same way by
DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, nbPoints ).
May be an easier way exist: Grid or something like that...

tanks

Phil..


4. Marching Cube on Point Clouds

5. Tetrahedralization and interpolating through a point cloud.

Hi, I have a random set of points in 3D each with an associated value
that needs to be smoothly interpolated through the volume the points
spans.

The "easiest" way of doing this i've seen so far is
1. Tetrahedralize the point cloud
2. Find which tetrahedra my location I want to sample the value is in.
3. Calculate the interpolated value by splitting the original
tetrahedra into subtetrahedra around the point weighting the volumes
against eachother.

A few questions
1. What is the easiest way to split a random set of points into
tetrahedras?
2. Can any point cloud be split into tetrahedras without introducing
additional (steiner) points?
3. Is there some other known volume interpolation techniques giving
decent results which might work better for this?

Thanks.

6. C++ codes For Surface reconstruction from Point cloud

7. where can I download cloud point?

Hello:

   I want to abtain some cloud points of 2D or 3D,.

   Does anyone know that where I can download  them?

   Thanks in advance !

8. Error Metric For Fitting Lines To Point Clouds