Re: [osg-users] Create Cylinder Around Line
Hi Ullrich, I followed the procedure suggested by you and it worked perfectly. However you mentioned that the procedure below But you should replace this with properly constructed geometry. I didn't quite follow what you meant by that. Also, I would like to save each individual geode (geometry) as an osg file to use later and not just load in this scene graph. Is there a way I can do that ? Looking forward to your suggestion. For a quick proof of concept and convenience you can use ShapeDrawables for the cylinders. But you should replace this with properly constructed geometry. That's only a rought outline of course. You may want to skip the NodeVisitor bit for starters and simply use a hard-coded list of start/end points. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34959#34959 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Ulrich, I wanted to know if the following is a worthwhile option: I have the data as a shapefile (.shp) and need to create the 3D model from that. I realize that osg can load shp files so is it a good option to modify the plugin dll that loads shp files ? So that when it comes across a polyline feature, it creates a cylinder around it and then loads it. Also, I tried loading a .shp in a trial program and using visual studio debugging step through, I was not able to step through the functions that are called in the dll (i took a look at the dll source code) Look forward to your opinion. Thanks, Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33209#33209 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Sanat, On 29/10/10 8:28 , Sanat Talmaki wrote: I have the data as a shapefile (.shp) and need to create the 3D model from that. I realize that osg can load shp files so is it a good option to modify the plugin dll that loads shp files ? So that when it comes across a polyline feature, it creates a cylinder around it and then loads it. Modifying plugins to implement application-specific behaviour is not a good idea. I always try to say as general as possible, eg. in your case to be able to load data from (best case) all supported file formats. I don't know shapefiles but I presume what you're after is stored as LINES or LINE_STRIPs. As roughtly outlined before I'd create a NodeVisitor that checks all Geodes to see if they have any LINES or LINE_STRIP geometry in them and if so extract the individual lines from that. This can then be used as input for the cylinder generation. Also, I tried loading a .shp in a trial program and using visual studio debugging step through, I was not able to step through the functions that are called in the dll (i took a look at the dll source code) You might need to tell VS where to find the source for the plugin or the pdb file. Sorry, I'm no VS expert :-| Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Ulrich, Sorry for my late reply. I will try these options out, though I have come to realize that it would be better for me to create the cylinders prior to creating .ive files. I was using osgGIS and I may be served well to use one of the filters in that to create a cylinder ive and load in osg. Thanks anywayas always the osg forum is the most helpful forum out there :) Cheers, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33034#33034 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
The code I hav is as below: Every .ive file loads a line object around which I want to draw a cylinder keeping that line as center. Code: int main( int argc, char **argv ) { osg::ref_ptrosg::Group root = new osg::Group(); osg::ref_ptrosg::Node pipe1; osg::ref_ptrosg::Node pipe2; pipe1 = osgDB::readNodeFile(pipes_out1.ive); pipe2 = osgDB::readNodeFile(pipes_out2.ive); pipe3 = osgDB::readNodeFile(pipes_out3.ive); root-addChild(pipe1.get()); root-addChild(pipe2.get()); root-addChild(pipe3.get()); while(!viewer.done()) {...loop...} .. } //main() Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32820#32820 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Sanat, On 19/10/10 4:13 , Sanat Talmaki wrote: The code I hav is as below: Every .ive file loads a line object around which I want to draw a cylinder keeping that line as center. ... Having a .ive file to specify the location of your cylinders/pipes complicates things a bit, but here goes: - write a NodeVisitor to collect the vertex arrays object of each .ive node (look for Geode, then Drawable, then getVertexArray of each drawable) - this gives you the start/end point of each line For a quick proof of concept and convenience you can use ShapeDrawables for the cylinders. But you should replace this with properly constructed geometry. - for each line, determine the length of the line - create a cylinder of that height - work out the orientation of the line (normalized(start - end) will give you a direction vector) - rotate the cylinder from its up vector (0,0,1) to that direction vector - move the cylinder to the position of the start point That's only a rought outline of course. You may want to skip the NodeVisitor bit for starters and simply use a hard-coded list of start/end points. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Create Cylinder Around Line
Hi, I have a number of .ive files that are simple line features. I am trying to create a cylinder around them such that the line is the center of the cylinder. I am not sure how I must go about to do this ? Any pointers will be appreciated. Thanks Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32767#32767 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org