本文整理汇总了C++中Box::Center方法的典型用法代码示例。如果您正苦于以下问题:C++ Box::Center方法的具体用法?C++ Box::Center怎么用?C++ Box::Center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box::Center方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupOrtho
/** \param boxIn Box coordinates of Frame to image.
* \param bp Output: Box + boundary.
* \param bm Output: Box - boundary.
* \param origin If true, image w.r.t. coordinate origin, otherwise box center.
* \return 1 if box lengths are zero, 0 if setup completed successfully.
*/
int Image::SetupOrtho(Box const& boxIn, Vec3& bp, Vec3& bm, bool origin) {
// Set up boundary information for orthorhombic cell
if (origin) {
bp = boxIn.Center();
bm.SetVec( -bp[0], -bp[1], -bp[2] );
} else {
bp.SetVec( boxIn.BoxX(), boxIn.BoxY(), boxIn.BoxZ() );
bm.Zero();
}
if (bp.IsZero()) return 1;
return 0;
}
示例2: GetBox
void Pin::GetBox(Box& boxOut)
{
boxOut.Center() = GetRigidBody().GetPosition();
Vector3 boxAxisX = GetRigidBody().GetROrientation() * Vector3::UNIT_X;
Vector3 boxAxisY = GetRigidBody().GetROrientation() * Vector3::UNIT_Y;
Vector3 boxAxisZ = GetRigidBody().GetROrientation() * Vector3::UNIT_Z;
boxOut.Axis(0) = boxAxisX;
boxOut.Axis(1) = boxAxisY;
boxOut.Axis(2) = boxAxisZ;
boxOut.Extent(0) = 0.31128f;
boxOut.Extent(1) = 0.31128f;
boxOut.Extent(2) = 0.97743f;
}
示例3: SetCenter
void SetCenter()
{ center = boundingbox.Center();}
示例4: BlockFillLocalH
//.........这里部分代码省略.........
Box<3> bbox (adfront->GetPoint (line.L().I1()));
bbox.Add (adfront->GetPoint (line.L().I2()));
double filld = filldist * bbox.Diam();
bbox.Increase (filld);
mesh.LocalHFunction().CutBoundary (bbox);
}
mesh.LocalHFunction().FindInnerBoxes (adfront, NULL);
npoints.SetSize(0);
mesh.LocalHFunction().GetInnerPoints (npoints);
changed = false;
for (int i = 0; i < npoints.Size(); i++)
{
if (mesh.LocalHFunction().GetH(npoints[i]) > 1.5 * maxh)
{
mesh.LocalHFunction().SetH (npoints[i], maxh);
changed = true;
}
}
}
while (changed);
if (debugparam.slowchecks)
(*testout) << "Blockfill with points: " << endl;
*testout << "loch = " << mesh.LocalHFunction() << endl;
*testout << "npoints = " << endl << npoints << endl;
for (int i = 1; i <= npoints.Size(); i++)
{
if (meshbox.IsIn (npoints.Get(i)))
{
PointIndex gpnum = mesh.AddPoint (npoints.Get(i));
adfront->AddPoint (npoints.Get(i), gpnum);
if (debugparam.slowchecks)
{
(*testout) << npoints.Get(i) << endl;
Point<2> p2d (npoints.Get(i)(0), npoints.Get(i)(1));
if (!adfront->Inside(p2d))
{
cout << "add outside point" << endl;
(*testout) << "outside" << endl;
}
}
}
}
// find outer points
loch2.ClearFlags();
for (int i = 0; i < adfront->GetNFL(); i++)
{
const FrontLine & line = adfront->GetLine(i);
Box<3> bbox (adfront->GetPoint (line.L().I1()));
bbox.Add (adfront->GetPoint (line.L().I2()));
loch2.SetH (bbox.Center(), bbox.Diam());
}
for (int i = 0; i < adfront->GetNFL(); i++)
{
const FrontLine & line = adfront->GetLine(i);
Box<3> bbox (adfront->GetPoint (line.L().I1()));
bbox.Add (adfront->GetPoint (line.L().I2()));
bbox.Increase (filldist * bbox.Diam());
loch2.CutBoundary (bbox);
}
loch2.FindInnerBoxes (adfront, NULL);
npoints.SetSize(0);
loch2.GetOuterPoints (npoints);
for (int i = 1; i <= npoints.Size(); i++)
{
if (meshbox.IsIn (npoints.Get(i)))
{
PointIndex gpnum = mesh.AddPoint (npoints.Get(i));
adfront->AddPoint (npoints.Get(i), gpnum);
}
}
}
示例5: BuildScene
void VisualSceneGeometry :: BuildScene (int zoomall)
{
VisualScene::BuildScene(zoomall); // setting light ...
Box<3> box;
int hasp = 0;
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
const TriangleApproximation & ta =
*geometry->GetTriApprox(i);
if (!&ta) continue;
for (int j = 0; j < ta.GetNP(); j++)
{
if (hasp)
box.Add (ta.GetPoint(j));
else
{
hasp = 1;
box.Set (ta.GetPoint(j));
}
}
}
if (hasp)
{
center = box.Center();
rad = box.Diam() / 2;
}
else
{
center = Point3d(0,0,0);
rad = 1;
}
CalcTransformationMatrices();
for (int i = 0; i < trilists.Size(); i++)
glDeleteLists (trilists[i], 1);
trilists.SetSize(0);
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
trilists.Append (glGenLists (1));
glNewList (trilists.Last(), GL_COMPILE);
glEnable (GL_NORMALIZE);
const TriangleApproximation & ta =
*geometry->GetTriApprox(i);
if (&ta)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, &ta.GetPoint(0)(0));
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_DOUBLE, 0, &ta.GetNormal(0)(0));
for (int j = 0; j < ta.GetNT(); j++)
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, & (ta.GetTriangle(j)[0]));
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
/*
for (int j = 0; j < ta.GetNT(); j++)
{
glBegin (GL_TRIANGLES);
for (int k = 0; k < 3; k++)
{
int pi = ta.GetTriangle(j)[k];
glNormal3dv (ta.GetNormal(pi));
glVertex3dv (ta.GetPoint(pi));
cout << "v = " << ta.GetPoint(pi) << endl;
}
glEnd ();
}
*/
}
glEndList ();
}
}