Hi,

just a thought. Maybe save the .osg file (see osgDB::writeNodeFile) of the triangulated sphere and check if only half the geometry is there or if all is there, but half has normals flipped.

jp

On 25/10/10 16:15, [email protected] wrote:
  Hi all,
currently I am writing my bachelor's thesis and I am programming in OSG.
Consequently, I am a so-called newbie.

Via 2 while-loops, which traverse the parametric representation of a
unit sphere around the origin, I receive supporting points. Singular
points are added manually.
I want to triangulate these supporting points to approximate the surface
of a unit sphere.
Therefore I pass a DelaunayTriangulator object my pointcloud (ca.
400points) and call its triangulate() method.

However, only the lower hemisphere is always triangulated. I tried to
translate the parametric representation, along the positive z-axis so
that there are no negative values for the coordinates. Even this does
not change the result.
I also tried to change the traversal of both for-loops but this did not
produce other results ,too.

At division of my pointcloud in two clouds (each ca. 400 points), one
for the lower and the other for the upper hemisphere, the triangulation
works without any problems.

Does anybody know the reason for my problem, or what am I doing wrong?

My code:
----------------------------------------------------------------------------------------------------------

geom= new Geometry();
objGeode_ = new Geode();
objGeode_->addDrawable(geom);
objGeode_->setNodeMask(objGeode_->getNodeMask() & (~Isect::Intersection)
& (~Isect::Pick));
rootNode->addChild(objGeode_);

//--------------------- array of vertices---------------------------------
int numVertices = 20;
double firstA = 0.0;
double firstB = 0.0;
double radian = 1.0;
int counterA;
int counterB;

Vec3Array *vecTriangArray = new Vec3Array;

//singular points
vecTriangArray->push_back(Vec3(0.0, 0.0, 1.0));
vecTriangArray->push_back(Vec3(0.0, 0.0, -1.0));

//Traverse the latitude then along the meridian
counterA = 1;
firstA =(PI / numVertices)*counterA;

while(firstA < PI){
counterB = 0;
firstB = 0.0;

while(firstB < 2*PI){
double x = radian * sin(firstA) * cos(firstB);
double y = radian * sin(firstA) * sin(firstB);
double z = radian * cos(firstA);
vecTriangArray->push_back(Vec3(x, y, z));
counterB++;
firstB = (2*PI / numVertices)*counterB;
}
counterA ++;
firstA =(PI / numVertices)*counterA;
}

geom -> setVertexArray(vecTriangArray);

//---------------Delaunay Triangulator-------------
DelaunayTriangulator *trig = new DelaunayTriangulator();
trig -> setInputPointArray(vecTriangArray);

//triangulate the points an add them to the primitive set
trig->triangulate();
geom->addPrimitiveSet(trig->getTriangles());

----------------------------------------------------------------------------------------------------------

Thank you,

Agnes



--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to