Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > RenderMan interface > Point Cloud API
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 755 of 786
Post > Topic >>

Point Cloud API

by Nicholas <Yue.Nicholas@[EMAIL PROTECTED] > Jan 7, 2008 at 12:56 AM

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 re****ted 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
 




 1 Posts in Topic:
Point Cloud API
Nicholas <Yue.Nicholas  2008-01-07 00:56:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 14:09:01 CDT 2008.