本文整理汇总了C++中SbMatrix::multVecMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ SbMatrix::multVecMatrix方法的具体用法?C++ SbMatrix::multVecMatrix怎么用?C++ SbMatrix::multVecMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SbMatrix
的用法示例。
在下文中一共展示了SbMatrix::multVecMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nilpoint
// Calculates the quad in 3D.
void
SoWidgetShape::getQuad(SoState * state, SbVec3f & v0, SbVec3f & v1,
SbVec3f & v2, SbVec3f & v3)
{
SbVec3f nilpoint(0.0f, 0.0f, 0.0f);
const SbMatrix & mat = SoModelMatrixElement::get(state);
mat.multVecMatrix(nilpoint, nilpoint);
const SbViewVolume &vv = SoViewVolumeElement::get(state);
SbVec3f screenpoint;
vv.projectToScreen(nilpoint, screenpoint);
const SbViewportRegion & vp = SoViewportRegionElement::get(state);
SbVec2s vpsize = vp.getViewportSizePixels();
// find normalized width and height of image
float nw = (float)this->image.width();
nw /= (float)vpsize[0];
float nh = (float)this->image.height();
nh /= (float)vpsize[1];
// need only half the width
nw *= 0.5f;
nh *= 0.5f;
SbVec2f n0, n1, n2, n3;
n0 = SbVec2f(screenpoint[0]-nw, screenpoint[1]-nh);
n1 = SbVec2f(screenpoint[0]+nw, screenpoint[1]-nh);
n2 = SbVec2f(screenpoint[0]+nw, screenpoint[1]+nh);
n3 = SbVec2f(screenpoint[0]-nw, screenpoint[1]+nh);
// get distance from nilpoint to camera plane
float dist = -vv.getPlane(0.0f).getDistance(nilpoint);
// find the four image points in the plane
v0 = vv.getPlanePoint(dist, n0);
v1 = vv.getPlanePoint(dist, n1);
v2 = vv.getPlanePoint(dist, n2);
v3 = vv.getPlanePoint(dist, n3);
// transform back to object space
SbMatrix inv = mat.inverse();
inv.multVecMatrix(v0, v0);
inv.multVecMatrix(v1, v1);
inv.multVecMatrix(v2, v2);
inv.multVecMatrix(v3, v3);
}
示例2: scaleVec
void
SoXipOverlayTransformBoxManip::scale( SoHandleEventAction* action )
{
// Extract the rotation matrix from the view matrix
SbMatrix rotationMatrix = extractRotationMatrix( mXBoundingBox.getInverse() );
// Get the two control points involved in the computation of the scale
// matrix (the one initially picked by the user and its opposit control
// point.
const SbVec3f& cp3d = mControlPointsCoords->point[ mControlPointId ];
const SbVec3f& opp_cp3d = mControlPointsCoords->point[ (mControlPointId + 4) % 8 ];
// Get the projection in the world of the current mouse position
SbVec3f p3d;
getPoint( action, p3d );
// Project the control points and the mouse world position on a xy plane
SbVec3f p2d, cp2d, opp_cp2d;
rotationMatrix.multVecMatrix( cp3d, cp2d );
rotationMatrix.multVecMatrix( opp_cp3d, opp_cp2d );
rotationMatrix.multVecMatrix( p3d, p2d );
SbVec3f refVec = cp2d - opp_cp2d;
SbVec3f movVec = p2d - opp_cp2d;
SbVec3f scaleVec(1, 1, 1);
for( int i = 0; i < 3; ++ i )
{
if( fabs( refVec[i] ) > 0.001 )
scaleVec[i] = movVec[i] / refVec[i];
}
// Compute the 2D scale matrix
SbMatrix scaleMatrix2D;
scaleMatrix2D.setScale( scaleVec );
// Use the opposit control point to center the shape (scale only regarding
// the picked control point)
SbMatrix centerMatrix;
centerMatrix.setTranslate( opp_cp3d );
mTransformationMatrix = centerMatrix.inverse() // Translate a point to the origin
* rotationMatrix // Rotate the plane to a xy aligned plane
* scaleMatrix2D // Scale the point in this plane
* rotationMatrix.inverse() // Rotate back to initial plane
* centerMatrix; // Undo the first translation
transform( mActionNode );
}
示例3: noTranslationLine
SbBool
SbCylinder::intersect(const SbLine &line, SbVec3f &enter, SbVec3f &exit) const
//
////////////////////////////////////////////////////////////////////////
{
// The intersection will actually be done on a radius 1 cylinder
// aligned with the y axis, so we transform the line into that
// space, then intersect, then transform the results back.
// rotation to y axis
SbRotation rotToYAxis(axis.getDirection(), SbVec3f(0,1,0));
SbMatrix mtxToYAxis;
mtxToYAxis.setRotate(rotToYAxis);
// scale to unit space
float scaleFactor = 1.0f/radius;
SbMatrix toUnitCylSpace;
toUnitCylSpace.setScale(SbVec3f(scaleFactor, scaleFactor, scaleFactor));
toUnitCylSpace.multLeft(mtxToYAxis);
// find the given line un-translated
SbVec3f origin = line.getPosition();
origin -= axis.getPosition();
SbLine noTranslationLine(origin, origin + line.getDirection());
// find the un-translated line in unit cylinder's space
SbLine cylLine;
toUnitCylSpace.multLineMatrix(noTranslationLine, cylLine);
// find the intersection on the unit cylinder
SbVec3f cylEnter, cylExit;
SbBool intersected = unitCylinderIntersect(cylLine, cylEnter, cylExit);
if (intersected) {
// transform back to original space
SbMatrix fromUnitCylSpace = toUnitCylSpace.inverse();
fromUnitCylSpace.multVecMatrix(cylEnter, enter);
enter += axis.getPosition();
fromUnitCylSpace.multVecMatrix(cylExit, exit);
exit += axis.getPosition();
}
return intersected;
}
示例4: mprIntersect
SbBool XipGeomUtils::mprIntersect(const SbMatrix & m1, const SbMatrix & m2, SbVec3f line[2], float viewportAspectRatio)
{
SbLine objLine, worldLine;
SbVec3f pt1, pt2;
int pc = 0;
SbPlane p1 = planeFromMatrix(m1);
SbPlane p2 = planeFromMatrix(m2);
float width = viewportAspectRatio < 1.f ? 1.f : viewportAspectRatio;
float height = viewportAspectRatio > 1.f ? 1.f : 1.f / viewportAspectRatio;
const SbLine frameLines[4] =
{
SbLine(SbVec3f(-width, -height, 0), SbVec3f(-width, height, 0)),
SbLine(SbVec3f(-width, -height, 0), SbVec3f( width, -height, 0)),
SbLine(SbVec3f( width, height, 0), SbVec3f(-width, height, 0)),
SbLine(SbVec3f( width, height, 0), SbVec3f( width, -height, 0))
};
// First, get intersecting line of the two planes.
if (!planeIntersect(p1, p2, worldLine)) return FALSE;
// Convert intersection line from world into object space before
// testing against frame lines, which are also in object space.
m1.inverse().multLineMatrix(worldLine, objLine);
SbVec3f normal = objLine.getDirection();
normal.normalize();
objLine = SbLine(objLine.getPosition(), objLine.getPosition() + normal);
// Intersect with the 4 lines of frame.
for (int i = 0; i < 4; i++)
{
//if (objLine.getClosestPoints(frameLines[i], pt1, pt2))
//{
// // Valid intersection point. Convert back to world space.
// m1.multVecMatrix(pt1, pt2);
// line[pc++] = pt2;
// if (pc > 1) break;
//}
if ((1.0f - abs(objLine.getDirection().dot(frameLines[i].getDirection()))) > 0.1f)
{
if (objLine.getClosestPoints(frameLines[i], pt1, pt2))
{
// Valid intersection point. Convert back to world space.
m1.multVecMatrix(pt1, pt2);
line[pc++] = pt2;
if (pc > 1) break;
}
}
}
return (pc == 2);
}
示例5: undo
void MicrotubuleTransformOperation::undo() {
SbMatrix invMat = mMat.inverse();
SpatialGraphSelection::Iterator iter(mSelection);
iter.vertices.reset();
int vNum = iter.vertices.nextSelected();
while (vNum != -1) {
McVec3f c = graph->getVertexCoords(vNum);
SbVec3f t(c.x, c.y, c.z);
SbVec3f res;
invMat.multVecMatrix(t, res);
graph->setVertexCoords(vNum, McVec3f(res[0], res[1], res[2]));
vNum = iter.vertices.nextSelected();
}
iter.edges.reset();
int eNum = iter.edges.nextSelected();
while (eNum != -1) {
McDArray<McVec3f> points = graph->getEdgePoints(eNum);
for (int p = 0; p < points.size(); p++) {
SbVec3f t(points[p].x, points[p].y, points[p].z);
SbVec3f res;
invMat.multVecMatrix(t, res);
points[p] = McVec3f(res[0], res[1], res[2]);
}
graph->setEdgePoints(eNum, points);
eNum = iter.edges.nextSelected();
}
int numPoints = mSelection.getNumSelectedPoints();
for (int i = 0; i < numPoints; ++i) {
SpatialGraphPoint p = mSelection.getSelectedPoint(i);
McDArray<McVec3f> points = graph->getEdgePoints(p.edgeNum);
SbVec3f t(points[p.pointNum].x, points[p.pointNum].y,
points[p.pointNum].z);
SbVec3f res;
invMat.multVecMatrix(t, res);
points[p.pointNum] = McVec3f(res[0], res[1], res[2]);
graph->setEdgePoints(p.edgeNum, points);
}
// update the transform parameters
for (int i = 0; i < mTransParams.size(); ++i) {
appendTransform(mTransParams[i], invMat);
}
}
示例6: InventorTriangleCB
/**
* This method extracts the triangle given by \p v1, \p v2, \p v3 and stores
* it in the TriMeshModel instance passed in through \p data by calling
* TriMeshModel::addTriangleWithFace() with the extracted triangle.
*/
void CoinVisualizationNode::InventorTriangleCB(void* data, SoCallbackAction* action,
const SoPrimitiveVertex* v1,
const SoPrimitiveVertex* v2,
const SoPrimitiveVertex* v3)
{
TriMeshModel* triangleMeshModel = static_cast<TriMeshModel*>(data);
if (!triangleMeshModel)
{
VR_INFO << ": Internal error, NULL data" << endl;
return;
}
SbMatrix mm = action->getModelMatrix();
SbMatrix scale;
scale.setScale(1000.0f); // simox operates in mm, coin3d in m
mm = mm.multRight(scale);
SbVec3f triangle[3];
mm.multVecMatrix(v1->getPoint(), triangle[0]);
mm.multVecMatrix(v2->getPoint(), triangle[1]);
mm.multVecMatrix(v3->getPoint(), triangle[2]);
SbVec3f normal[3];
/*mm.multVecMatrix(v1->getNormal(), normal[0]);
mm.multVecMatrix(v2->getNormal(), normal[1]);
mm.multVecMatrix(v3->getNormal(), normal[2]);*/
mm.multDirMatrix(v1->getNormal(), normal[0]);
mm.multDirMatrix(v2->getNormal(), normal[1]);
mm.multDirMatrix(v3->getNormal(), normal[2]);
normal[0] = (normal[0] + normal[1] + normal[2]) / 3.0f;
// read out vertices
Eigen::Vector3f a, b, c, n;
a << triangle[0][0], triangle[0][1], triangle[0][2];
b << triangle[1][0], triangle[1][1], triangle[1][2];
c << triangle[2][0], triangle[2][1], triangle[2][2];
n << normal[0][0], normal[0][1], normal[0][2];
// add new triangle to the model
triangleMeshModel->addTriangleWithFace(a, b, c, n);
}
示例7:
bool
XipGeomUtils::isInside(const SbVec3f &u, const SbMatrix &model)
{
SbMatrix inv = model.inverse();
SbVec3f v;
inv.multVecMatrix(u, v);
if ( v[0]<0.0f || v[1]<0.0f || v[2]<0.0f ) return false;
if ( v[0]>1.0f || v[1]>1.0f || v[2]>1.0f ) return false;
return true;
}
示例8: idleCB
void SoFCCSysDragger::idleCB(void *data, SoSensor *)
{
SoFCCSysDragger *sudoThis = reinterpret_cast<SoFCCSysDragger *>(data);
assert(sudoThis->camera);
SbMatrix localToWorld = sudoThis->getLocalToWorldMatrix();
SbVec3f origin;
localToWorld.multVecMatrix(SbVec3f(0.0, 0.0, 0.0), origin);
SbViewVolume viewVolume = sudoThis->camera->getViewVolume();
float radius = sudoThis->draggerSize.getValue() / 2.0;
float localScale = viewVolume.getWorldToScreenScale(origin, radius);
SbVec3f scaleVector(localScale, localScale, localScale);
SoScale *localScaleNode = SO_GET_ANY_PART(sudoThis, "scaleNode", SoScale);
localScaleNode->scaleFactor.setValue(scaleVector);
sudoThis->autoScaleResult.setValue(localScale);
}
示例9: dragStart
void RDragger::dragStart()
{
SoSwitch *sw;
sw = SO_GET_ANY_PART(this, "rotatorSwitch", SoSwitch);
SoInteractionKit::setSwitchValue(sw, 1);
projector.setViewVolume(this->getViewVolume());
projector.setWorkingSpace(this->getLocalToWorldMatrix());
projector.setPlane(SbPlane(SbVec3f(0.0, 0.0, 1.0), 0.0));
SbVec3f hitPoint;
if (!projector.tryProject(getNormalizedLocaterPosition(), 0.0, hitPoint))
return;
hitPoint.normalize();
SbMatrix localToWorld = getLocalToWorldMatrix();
localToWorld.multVecMatrix(hitPoint, hitPoint);
setStartingPoint((hitPoint));
rotationIncrementCount.setValue(0);
}
示例10:
/*!
Should be called after motion matrix has been updated by a child
dragger.
*/
void
SoCenterballDragger::transferCenterDraggerMotion(SoDragger * childdragger)
{
if (coin_assert_cast<SoNode *>(childdragger) == XCenterChanger.getValue() ||
coin_assert_cast<SoNode *>(childdragger) == YCenterChanger.getValue() ||
coin_assert_cast<SoNode *>(childdragger) == ZCenterChanger.getValue()) {
// translate part of matrix should not change. Move motion
// into center instead.
SbVec3f transl;
SbMatrix matrix = this->getMotionMatrix();
transl[0] = matrix[3][0];
transl[1] = matrix[3][1];
transl[2] = matrix[3][2];
SbVec3f difftransl = transl - this->savedtransl;
{ // consider rotation before translating
SbRotation rot = this->rotation.getValue();
SbMatrix tmp;
tmp.setRotate(rot.inverse());
tmp.multVecMatrix(difftransl, difftransl);
}
this->centerFieldSensor->detach();
this->center = difftransl + this->savedcenter;
this->centerFieldSensor->attach(&this->center);
matrix[3][0] = this->savedtransl[0];
matrix[3][1] = this->savedtransl[1];
matrix[3][2] = this->savedtransl[2];
SbBool oldval = this->enableValueChangedCallbacks(FALSE);
this->setMotionMatrix(matrix);
this->enableValueChangedCallbacks(oldval);
SoMatrixTransform *mt = SO_GET_ANY_PART(this, "translateToCenter", SoMatrixTransform);
matrix.setTranslate(this->center.getValue());
mt->matrix = matrix;
}
}
示例11: translatePlaneNormal
// computes translation of a plane along it's normal given any 3-D
// translation of the intersection position
SbMatrix XipGeomUtils::translatePlaneNormal(SbMatrix plane, SbVec3f translation)
{
SbMatrix transMatrix, newPlane;
SbVec3f centerWorld, shiftImage;
// re-positioning of intersection marker
transMatrix.setTranslate(translation);
newPlane = plane * transMatrix;
// determine shift in 2D image output
plane.multVecMatrix(SbVec3f(0, 0, 0), centerWorld);
newPlane.inverse().multVecMatrix(centerWorld, shiftImage);
// correct for x-shift
transMatrix.setTranslate(shiftImage[0] * SbVec3f(newPlane[0][0], newPlane[0][1], newPlane[0][2]));
newPlane *= transMatrix;
// correct for y-shift
transMatrix.setTranslate(shiftImage[1] * SbVec3f(newPlane[1][0], newPlane[1][1], newPlane[1][2]));
newPlane *= transMatrix;
// return new plane
return newPlane;
}
示例12: getWorldToLocalMatrix
void
SoDragPointDragger::checkBoxLimits()
//
////////////////////////////////////////////////////////////////////////
{
// The limit box is defined in a space aligned and scaled as LOCAL
// space, but with it's center remaining fixed in WORLD space.
// We need to do this work in LOCAL space, so to begin with,
// get the location of the center of this box in LOCAL space.
SbMatrix worldToLocal = getWorldToLocalMatrix();
SbVec3f limitBoxCenterInLocal = limitBox.getCenter();
worldToLocal.multVecMatrix( limitBoxCenterInLocal,
limitBoxCenterInLocal );
// Now, if our current position is out of range, we need to move
// the limit box center accordingly. We continue to do our work
// in LOCAL space.
SbBool changed = FALSE;
SbVec3f boxSize = limitBox.getMax() - limitBox.getMin();
for (int i = 0; i < 3; i++) {
float length = boxSize[i];
float halfLength = length * 0.5;
// Check the location of startLocalHitPt against boundaries of the limit
// box (keeping in mind the jump limit as a % of the total length).
// Have we gone too far in the positive direction?
float high = limitBoxCenterInLocal[i] + halfLength;
while ( (high - startLocalHitPt[i]) / length < jumpLimit ) {
limitBoxCenterInLocal[i] += halfLength;
high += halfLength;
changed = TRUE;
}
// Have we gone too far in the negative direction?
float low = limitBoxCenterInLocal[i] - halfLength;
while (( startLocalHitPt[i] - low ) / length < jumpLimit ) {
limitBoxCenterInLocal[i] -= halfLength;
low -= halfLength;
changed = TRUE;
}
}
if (changed == TRUE ) {
// First, convert the changed limitBoxCenterInLocal
// into WORLD space...
SbMatrix localToWorld = getLocalToWorldMatrix();
SbVec3f newCenter;
localToWorld.multVecMatrix(limitBoxCenterInLocal,newCenter);
// Next, set the bounds of the limit box to have the same size
// as before, but centered about this new point.
SbVec3f diag = limitBox.getMax() -
limitBox.getCenter();
limitBox.setBounds( newCenter - diag, newCenter + diag );
}
}
示例13: applyMatrix
SbVec3f ManipWidget::applyMatrix(const SbMatrix &mat, const SbVec3f &in)
{
SbVec3f out;
mat.multVecMatrix(in, out);
return out;
}
示例14: doClipping
void doClipping(SbVec3f trans, SbRotation rot)
{
SbMatrix mat;
SbVec3f normal;
mat.setTransform(trans, rot, SbVec3f(1,1,1));
mat.multDirMatrix(SbVec3f(0, -1, 0), normal);
SbPlane plane(normal, trans);
const float coords[][3] = {
{-5,-5,-5},
{5,-5,-5},
{5,5,-5},
{-5,5,-5},
{-5,-5,5},
{5,-5,5},
{5,5,5},
{-5,5,5}
};
const int indices[] = {
0,3,2,1,-1,
0,1,5,4,-1,
2,6,5,1,-1,
3,7,6,2,-1,
3,0,4,7,-1,
7,4,5,6,-1
};
// Clip box against plane
SbClip clip;
SoMFVec3f * globalVerts =
(SoMFVec3f *)SoDB::getGlobalField(SbName("globalVerts"));
SoMFVec3f * globalTVerts =
(SoMFVec3f *)SoDB::getGlobalField(SbName("globalTVerts"));
SoMFInt32 * globalnv =
(SoMFInt32 *)SoDB::getGlobalField(SbName("globalnv"));
globalVerts->startEditing();
globalVerts->setNum(0);
globalTVerts->startEditing();
globalTVerts->setNum(0);
globalnv->startEditing();
globalnv->setNum(0);
int i;
for (i = 0;i<6*5;i++) {
if (indices[i] == -1) {
clip.clip(plane);
int numVerts = clip.getNumVertices();
if (numVerts > 0) {
for (int j = 0;j<numVerts;j++) {
SbVec3f v;
clip.getVertex(j, v);
globalVerts->set1Value(globalVerts->getNum(), v);
v += SbVec3f(5, 5, 5);
v /= 10.0;
globalTVerts->set1Value(globalTVerts->getNum(), v);
}
globalnv->set1Value(globalnv->getNum(), numVerts);
}
clip.reset();
}
else clip.addVertex(coords[indices[i]]);
}
globalVerts->finishEditing();
globalTVerts->finishEditing();
globalnv->finishEditing();
// Close hole in clipped box by clipping against all 6 planes
const SbVec3f planecoords[] = {
SbVec3f(-10,0,-10),
SbVec3f(10,0,-10),
SbVec3f(10,0,10),
SbVec3f(-10,0,10)
};
clip.reset();
for (i = 0;i<4;i++) {
SbVec3f v;
mat.multVecMatrix(planecoords[i], v);
clip.addVertex(v);
}
for (i = 0;i<6*5;i+=5) {
SbPlane p(coords[indices[i+2]],
coords[indices[i+1]],
coords[indices[i]]);
clip.clip(p);
}
int numVerts = clip.getNumVertices();
SoMFVec3f * planeVerts =
(SoMFVec3f *)SoDB::getGlobalField(SbName("planeVerts"));
SoMFVec3f * planeTVerts =
(SoMFVec3f *)SoDB::getGlobalField(SbName("planeTVerts"));
planeVerts->startEditing();
planeVerts->setNum(0);
planeTVerts->startEditing();
planeTVerts->setNum(0);
for (i = 0;i<numVerts;i++) {
SbVec3f v;
//.........这里部分代码省略.........
示例15: origo
//.........这里部分代码省略.........
Cvr3DTexCube::INDEXEDFACE_SET :
Cvr3DTexCube::INDEXEDTRIANGLESTRIP_SET);
this->cube->renderIndexedSet(action, vertexarray, cindices, numindices, type);
glPopAttrib();
// 'un-Transform' model matrix before rendering clip geometry.
state->pop();
// Render the geometry which are outside the volume cube as polygons.
if (clipGeometry) {
// Is there a clipplane left for us to use?
GLint maxclipplanes = 0;
glGetIntegerv(GL_MAX_CLIP_PLANES, &maxclipplanes);
const SoClipPlaneElement * elem = SoClipPlaneElement::getInstance(state);
if (elem->getNum() > (maxclipplanes-1)) {
static SbBool flag = FALSE;
if (!flag) {
flag = TRUE;
SoDebugError::postWarning("CvrIndexedSetRenderBaseP::GLRender",
"\"clipGeometry TRUE\": Not enough clip planes available. (max=%d)",
maxclipplanes);
}
return;
}
if (this->parentnodeid != this->master->getNodeId()) { // Changed recently?
SoVertexProperty * vertprop = (SoVertexProperty *) this->master->vertexProperty.getValue();
if (vertprop != NULL) this->clipgeometryshape->vertexProperty.setValue(vertprop);
this->clipgeometryshape->coordIndex.setNum(this->master->coordIndex.getNum());
this->clipgeometryshape->materialIndex.setNum(this->master->materialIndex.getNum());
int32_t * idst = this->clipgeometryshape->coordIndex.startEditing();
int32_t * mdst = this->clipgeometryshape->materialIndex.startEditing();
int i=0;
for (i=0;i<this->master->coordIndex.getNum();++i)
*idst++ = this->master->coordIndex[i];
for (i=0;i<this->master->materialIndex.getNum();++i)
*mdst++ = this->master->materialIndex[i];
// No need to copy texture coords as the face set shall always be untextured.
this->parentnodeid = this->master->getNodeId();
this->clipgeometryshape->coordIndex.finishEditing();
this->clipgeometryshape->materialIndex.finishEditing();
}
SbPlane cubeplanes[6];
SbVec3f a, b, c;
// FIXME: Its really not necessary to calculate the clip planes
// for each frame unless the volume has changed. This should be
// optimized somehow.(20040629 handegar)
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, dims[1], 0.0f)), a);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, dims[1], dims[2])), b);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], dims[1], 0.0f)), c);
cubeplanes[0] = SbPlane(a, b, c); // Top
volumetransform.multVecMatrix(SbVec3f(origo), a);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], 0.0f, 0.0f)), b);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, 0.0f, dims[2])), c);
cubeplanes[1] = SbPlane(a, b, c); // Bottom
volumetransform.multVecMatrix(SbVec3f(origo), a);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, dims[1], 0.0f)), b);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], 0.0f, 0.0f)), c);
cubeplanes[2] = SbPlane(a, b, c); // Back
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, 0.0f, dims[2])), a);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], 0.0f, dims[2])), b);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, dims[1], dims[2])), c);
cubeplanes[3] = SbPlane(a, b, c); // Front
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], 0.0f, 0.0f)), a);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], dims[1], 0.0f)), b);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(dims[0], 0.0f, dims[2])), c);
cubeplanes[4] = SbPlane(a, b, c); // Right
volumetransform.multVecMatrix(SbVec3f(origo), a);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, 0.0f, dims[2])), b);
volumetransform.multVecMatrix(SbVec3f(origo + SbVec3f(0.0f, dims[1], 0.0f)), c);
cubeplanes[5] = SbPlane(a, b, c); // Left
for (int i=0;i<6;++i) {
state->push();
// FIXME: It would have been nice to have a 'remove' or a 'replace'
// method in the SoClipPlaneElement so that we wouldn't have to
// push and pop the state. (20040630 handegar)
SoClipPlaneElement::add(state, this->master, cubeplanes[i]);
this->clipgeometryshape->GLRender(action);
state->pop();
}
}
}