Hi Allen,

On Mon, 2005-06-27 at 11:04 -0500, Allen Bierbaum wrote:
> How does makeExtrusionGeo work?

see http://www.web3d.org/x3d/specifications/ISO-IEC-19775-IS-
X3DAbstractSpecification/Part01/components/geometry3D.html#Extrusion

> Or more specifically:
> 
> If I have some "flat" geometry in OpenSG and I would like to extrude it 
> "back" a few units to get a 3D version of the geometry, can I use 
> makeExtrusionGeo to do this?

Not directly from the Geometry, but it's pretty simple.

> A simple example that may help is: If I had the corners of a 2D square 
> and I wanted to extrude this into a 3D box, what would the code look like?

Like this:

NodePtr extrudeOutline(std::vector<Pnt2f>& outline, Real32 distance)
{
    std::vector<Pnt3f> spine;
    std::vector<Quaternion> orientation;
    std::vector<Vec2f> scale;

    spine.push_back(Pnt3f(0,0,0));
    spine.push_back(Pnt3f(0,0,-distance));
    
    orientation.push_back(Quaternion());
    orientation.push_back(Quaternion());
    
    scale.push_back(Vec2f(1,1));
    scale.push_back(Vec2f(1,1));

    GeometryPtr geo = makeExtrusionGeo(
                               outline,
                               orientation, 
                               scale,
                               spine,
                               0.f,
                               true,   // bool _beginCap
                               true,   // bool _endCap
                               false,  // bool _ccw
                               true,   // bool _convex
                               true,   // bool _buildNormal
                               true,   // bool _buildTexCoord
                               0);     // UInt32 _numOfSubdivision
    
    beginEditCP(geo);
    geo->setMaterial(getDefaultMaterial());
    endEditCP(geo);
    
    return makeNodeFor(geo);
}


section.push_back(Pnt2f(-1,-1));
section.push_back(Pnt2f(1,-1)); 
section.push_back(Pnt2f(1,1));
section.push_back(Pnt2f(-1,1));
section.push_back(Pnt2f(-1,-1));

obj = extrudeOutline(section, 2);


Hope it helps

        Dirk

-- 
-- Dirk Reiners               OpenSG Forum             [EMAIL PROTECTED] 
-- The OpenSG Open Source Scenegraph:            http://www.opensg.org
-- Join the list at    http://lists.sf.net/lists/listinfo/opensg-users



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to