[osg-users] calculating area of the 3d model.

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Wed Nov 16 06:17:20 PST 2016

Hi Uma
> Hi all,
>      I would like to know some information.
>      I need to calculate area , perimeter & volume of a selected part or area in 3d model. For example after rendering 3d model, if I select some area(cloased area) , say point1 point2 point3. Point1 connected to point2 point2 to point3, point3 connected to point1. Is it possible to do it with the help of OSG.?
There might be some helper functions, but basically perimeter and area 
need some adjacency information, so I guess you need to do some 
additional work.
>    And how can I get longitude,latitude and altitude for the points(say point1).? Is there any example for this.? So that it can be helpful for me.
That doesn't make sense really if your "points" are not ECEF. Basically 
you can use the osg::CoordinateSystemNode and the projection to convert 
geographic and geocentric coordinates.

In order to transform a local mesh to a specific lat-lon position you 
need to orient the model at the local tangent plane (you can get the 
matrix from the CoordinateSystemNode (set up with the ellipsoidmodell):

osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode();
		csn->setEllipsoidModel(new osg::EllipsoidModel());
		osg::Matrixd local_frame = csn->computeLocalCoordinateFrame(position);

For orientation simply rotate your model by the local_frame, where the 
position is ECEF. You can obtain an ECEF-position relative to the chosen 
Ellipsoid by using the 
Ellipsoid::computeLocalToWorldTransformFromLatLongHeight function.

> Do I need to build any other OSG application for this task.?  Where does the longitude,latitude and altitude informations are stored in 3d models (.3ds,.osg,.osgt)?
There is no fixed coordinate system in the files/OSG. The coordinates 
are simply numbers in an (orthonormal) coordinate frame. So it is up to 
you to interpret them as being angles, meters, microfortnights or whatever.

> ...
> Thank you!
> Cheers,
> Uma
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69400#69400
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list