本文整理汇总了C++中Bound类的典型用法代码示例。如果您正苦于以下问题:C++ Bound类的具体用法?C++ Bound怎么用?C++ Bound使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bound类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateScene
//----------------------------------------------------------------------------
bool Rope::OnInitialize ()
{
if ( !Application::OnInitialize() )
return false;
CreateScene();
// center-and-fit for camera viewing
m_spkScene->UpdateGS(0.0f);
Bound kWBound = m_spkScene->WorldBound();
m_spkTrnNode->Translate() = -kWBound.Center();
ms_spkCamera->SetFrustum(1.0f,100.0f,-0.55f,0.55f,0.4125f,-0.4125f);
Vector3f kCLeft(1.0f,0.0f,0.0f);
Vector3f kCUp(0.0f,0.0f,1.0f);
Vector3f kCDir(0.0f,-1.0f,0.0f);
Vector3f kCLoc = -3.0f*kWBound.Radius()*kCDir - 0.5f*kCUp;
ms_spkCamera->SetFrame(kCLoc,kCLeft,kCUp,kCDir);
// initial update of objects
ms_spkCamera->Update();
m_spkScene->UpdateGS(0.0f);
m_spkScene->UpdateRS();
// camera turret and tumble mode
m_spkMotionObject = m_spkScene;
m_fTrnSpeed = 0.01f;
m_fRotSpeed = 0.01f;
m_bTurretActive = true;
SetTurretAxes();
return true;
}
示例2: unbind
void AnalysisForm::bindTo(Options *options, DataSet *dataSet)
{
if (_options != NULL)
unbind();
_dataSet = dataSet;
_options = options;
for(const string &name : options->names)
{
Option *option = options->get(name);
QString qsName = QString::fromUtf8(name.c_str(), name.length());
qsName.replace('/', '_');
QWidget *child = this->findChild<QWidget*>(qsName);
Bound *boundChild = dynamic_cast<Bound*>(child);
if (boundChild != NULL)
{
_bounds.push_back(boundChild);
boundChild->bindTo(option);
boundChild->illegalChanged.connect(boost::bind(&AnalysisForm::illegalValueHandler, this, _1));
}
else
qDebug() << "child not found : " << qsName << " in AnalysisForm::setOptions()";
}
updateIllegalStatus();
}
示例3: i
bool Feedback::is_route_turned() const {
std::vector<Cell> route_arr;
std::vector<Bound> bounds;
for(auto I=route.begin(); I!=route.end(); I++) {
route_arr.push_back(*I);
}
for(int i=0; (i+1)<route_arr.size(); i++) {
Cell current = route_arr[i];
Cell next = route_arr[i+1];
std::list<Bound> adjacents = current.get_adjacents();
for(auto J=adjacents.begin(); J!=adjacents.end(); J++) {
if(J->get_target() == next) {
bounds.push_back(*J);
} // the corressponding bound
} // for adjacents
} // for i (index of arr)
for(int i=0; (i+1)<bounds.size(); i++) {
Bound current = bounds[i];
Bound next = bounds[i+1];
if(!next.is_linkable(current, false)) {
// 不能轉向的話接不上
// 結論:轉向了
return true;
}
}
return false;
}
示例4: updateIllegalStatus
void AnalysisForm::unbind()
{
_bounds.clear();
updateIllegalStatus();
if (_options == NULL)
return;
BOOST_FOREACH(const string &name, _options->names)
{
Option *option = _options->get(name);
QString qsName = QString::fromUtf8(name.c_str(), name.length());
qsName.replace('/', '_');
QWidget *child = this->findChild<QWidget*>(qsName);
Bound *boundChild = dynamic_cast<Bound*>(child);
if (boundChild != NULL)
boundChild->unbind();
}
_options = NULL;
}
示例5: kCLeft
//----------------------------------------------------------------------------
bool EnvironmentMaps::OnInitialize ()
{
if ( !Application::OnInitialize() )
return false;
if ( !Setup() )
return true;
m_spkScene->UpdateGS(0.0f);
Bound kWBound = m_spkScene->WorldBound();
m_spkTrnNode->Translate() = -kWBound.Center();
ms_spkCamera->SetFrustum(1.0f,10000.0f,-0.55f,0.55f,0.4125f,-0.4125f);
Vector3f kCLeft(0.0f,0.0f,-1.0f);
Vector3f kCUp(0.0f,1.0f,0.0f);
Vector3f kCDir(1.0f,0.0f,0.0f);
Vector3f kCLoc = -3.0f*kWBound.Radius()*kCDir;
ms_spkCamera->SetFrame(kCLoc,kCLeft,kCUp,kCDir);
// initial update of objects
ms_spkCamera->Update();
m_spkScene->UpdateGS(0.0f);
m_spkScene->UpdateRS();
m_spkMotionObject = m_spkScene;
m_fTrnSpeed = 1.0f;
m_fRotSpeed = 0.01f;
m_bTurretActive = true;
SetTurretAxes();
m_bInitialized = true;
return true;
}
示例6: SetSphere
VOID Bound::Merge( const Bound& Other )
{
Sphere OtherSphere;
OtherSphere.Center = Other.GetCenter();
OtherSphere.Radius = Other.GetMaxRadius();
if( m_Type == Bound::No_Bound )
{
SetSphere( OtherSphere );
return;
}
Sphere ThisSphere;
if( m_Type != Bound::Sphere_Bound )
{
// convert this bound into a sphere
ThisSphere.Center = GetCenter();
ThisSphere.Radius = GetMaxRadius();
}
else
{
ThisSphere = GetSphere();
}
XMVECTOR vThisCenter = XMLoadFloat3( &ThisSphere.Center );
XMVECTOR vOtherCenter = XMLoadFloat3( &OtherSphere.Center );
XMVECTOR vThisToOther = XMVectorSubtract( vOtherCenter, vThisCenter );
XMVECTOR vDistance = XMVector3LengthEst( vThisToOther );
FLOAT fCombinedDiameter = XMVectorGetX( vDistance ) + ThisSphere.Radius + OtherSphere.Radius;
if( fCombinedDiameter <= ( ThisSphere.Radius * 2 ) )
{
SetSphere( ThisSphere );
return;
}
if( fCombinedDiameter <= ( OtherSphere.Radius * 2 ) )
{
SetSphere( OtherSphere );
return;
}
XMVECTOR vDirectionNorm = XMVector3Normalize( vThisToOther );
XMVECTOR vRadius = XMVectorSet( ThisSphere.Radius, OtherSphere.Radius, 0, 0 );
XMVECTOR vThisRadius = XMVectorSplatX( vRadius );
XMVECTOR vOtherRadius = XMVectorSplatY( vRadius );
XMVECTOR vCombinedDiameter = vThisRadius + vDistance + vOtherRadius;
XMVECTOR vMaxDiameter = XMVectorMax( vCombinedDiameter, vThisRadius * 2 );
vMaxDiameter = XMVectorMax( vMaxDiameter, vOtherRadius * 2 );
XMVECTOR vMaxRadius = vMaxDiameter * 0.5f;
ThisSphere.Radius = XMVectorGetX( vMaxRadius );
vMaxRadius -= vThisRadius;
XMVECTOR vCombinedCenter = vThisCenter + vMaxRadius * vDirectionNorm;
XMStoreFloat3( &ThisSphere.Center, vCombinedCenter );
SetSphere( ThisSphere );
}
示例7: set_right
// Reset right bound (must be to >= left bound.)
void BiVector::set_right(const Bound &e)
{
assert(left.is_infinite() || e.is_infinite() ||
left.value() <= e.value());
if (!e.is_infinite() && (right.is_infinite() || e.value() < right.value()))
{
right = e;
trim_bivector_at_right();
} else
right = e;
}
示例8: set_left
// Reset left bound (must be to <= right bound.)
void BiVector::set_left(const Bound &e)
{
assert(e.is_infinite() || right.is_infinite() ||
e.value() <= right.value());
if (!e.is_infinite() && (left.is_infinite() || e.value() > left.value()))
{
left = e;
trim_bivector_at_left();
} else
left = e;
}
示例9: Node
//----------------------------------------------------------------------------
bool WaterDropFormation::OnInitialize ()
{
if ( !Application::OnInitialize() )
return false;
// create scene
m_spkScene = new Node;
m_spkTrnNode = new Node(3);
m_spkScene->AttachChild(m_spkTrnNode);
CreatePlane();
CreateWall();
CreateWaterRoot();
// wireframe
m_spkWireframe = new WireframeState;
m_spkScene->SetRenderState(m_spkWireframe);
// depth buffer
ZBufferState* pkZBuffer = new ZBufferState;
pkZBuffer->Enabled() = true;
pkZBuffer->Writeable() = true;
pkZBuffer->Compare() = ZBufferState::CF_LEQUAL;
m_spkScene->SetRenderState(pkZBuffer);
Configuration0();
// center-and-fit for camera viewing
m_spkScene->UpdateGS(0.0f);
Bound kWBound = m_spkScene->WorldBound();
m_spkTrnNode->Translate() = -kWBound.Center();
ms_spkCamera->SetFrustum(0.1f,1000.0f,-0.055f,0.055f,0.04125f,-0.04125f);
float fAngle = 0.01f*Mathf::PI;
float fCos = Mathf::Cos(fAngle), fSin = Mathf::Sin(fAngle);
Vector3f kCUp(fSin,0.0f,-fCos);
Vector3f kCDir(-fCos,0.0f,-fSin);
Vector3f kCLeft(0.0f,1.0f,0.0f);
Vector3f kCLoc = -0.9f*kWBound.Radius()*kCDir;
ms_spkCamera->SetFrame(kCLoc,kCLeft,kCUp,kCDir);
// initial update of objects
ms_spkCamera->Update();
m_spkScene->UpdateGS(0.0f);
m_spkScene->UpdateRS();
m_spkMotionObject = m_spkScene;
m_bTurretActive = true;
SetTurretAxes();
m_fTrnSpeed = 0.01f;
m_fRotSpeed = 0.001f;
m_fLastSeconds = GetTimeInSeconds();
return true;
}
示例10: ReadAggregate
bool InStream::ReadAggregate (Bound& datum)
{
APoint center;
float radius;
if (!ReadAggregate(center) || !Read(radius))
{
return false;
}
datum.SetCenter(center);
datum.SetRadius(radius);
return true;
}
示例11: HIERARCHICAL_PROFILE
he::IntersectResult CameraPerspective::intersect( const Bound& bound ) const
{
HIERARCHICAL_PROFILE(__HE_FUNCTION__);
const Sphere& camSphereBound(m_Bound.getSphere());
const Cone& camConeBound(m_Bound.getCone());
const Frustum& frustumBound(m_Bound.getFrustum());
const Sphere& otherSphereBound(bound.getSphere());
// Fast sphere - sphere test
{
HIERARCHICAL_PROFILE("Sphere Test");
if (camSphereBound.intersectTest(otherSphereBound) == false)
return IntersectResult_Outside;
}
{
HIERARCHICAL_PROFILE("Cone Test");
// Fast cone - sphere test
if (camConeBound.intersectTest(otherSphereBound) == false)
return IntersectResult_Outside;
}
// sphere frustum test
{
HIERARCHICAL_PROFILE("Frustum Test");
switch(frustumBound.intersect(otherSphereBound))
{
case IntersectResult_Outside:
return IntersectResult_Outside;
case IntersectResult_Inside:
return IntersectResult_Inside;
case IntersectResult_Intersecting:
{
HIERARCHICAL_PROFILE("Slow Frustum Test");
switch(frustumBound.intersect(bound.getAABB()))
{
case IntersectResult_Outside:
return IntersectResult_Outside;
case IntersectResult_Inside:
return IntersectResult_Inside;
case IntersectResult_Intersecting:
return IntersectResult_Intersecting;
}
}
break;
}
}
LOG(LogType_ProgrammerAssert, "Should never get here");
return IntersectResult_Outside;
}
示例12:
bool
ZoneBox::in_interval (const double point, const Bound& from, const Bound& to)
{
if (from.type () == Bound::finite
&& point <= from.value ())
// Point before interval.
return false;
if (to.type () == Bound::finite
&& point > to.value ())
// Point after interval.
return false;
// Point in interval.
return true;
}
示例13: bounds2DSweepR
//==================================================================
inline void bounds2DSweepR(
Bound &out_bound,
float r,
float phiMin,
float phiMax )
{
out_bound.Expand( polar(r, phiMin) );
out_bound.Expand( polar(r, phiMax) );
for (int i=-3; i < 4; ++i)
{
float phi = i * FM_PI_2;
if ( phiMin < phi && phiMax > phi )
out_bound.Expand( polar( r, phi ) );
}
}
示例14: TestIntersection
//----------------------------------------------------------------------------
bool Bound::TestIntersection (const Bound& bound, float tmax,
const AVector& velocity0, const AVector& velocity1) const
{
if (bound.GetRadius() == 0.0f || GetRadius() == 0.0f)
{
return false;
}
AVector relVelocity = velocity1 - velocity0; // 相对速度
AVector cenDiff = bound.mCenter - mCenter; // 相对位移
float a = relVelocity.SquaredLength();
float c = cenDiff.SquaredLength();
float rSum = bound.mRadius + mRadius;
float rSumSqr = rSum*rSum;
if (a > 0.0f)
{
float b = cenDiff.Dot(relVelocity);
if (b <= 0.0f)
{
if (-tmax*a <= b)
{
return a*c - b*b <= a*rSumSqr;
}
else
{
return tmax*(tmax*a + 2.0f*b) + c <= rSumSqr;
}
}
}
return c <= rSumSqr;
}
示例15: MakeBound
void Sphere::MakeBound( Bound &out_bound ) const
{
float tuMin = mThetamaxRad * mURange[0];
float tuMax = mThetamaxRad * mURange[1];
float alphaMin = DASin( mZMin / mRadius );
float alphaMax = DASin( mZMax / mRadius );
float aVMin = DMix( alphaMin, alphaMax, mVRange[0] );
float aVMax = DMix( alphaMin, alphaMax, mVRange[1] );
float rVMin = DCos( aVMin ) * mRadius;
float rVMax = DCos( aVMax ) * mRadius;
float rMin = DMIN( rVMin, rVMax );
float rMax;
if ( aVMin < 0 && aVMax > 0 )
rMax = mRadius;
else
rMax = DMAX( rVMin, rVMax );
out_bound.Reset();
bounds2DSweepL( out_bound, rMin, rMax, tuMin, tuMax );
out_bound.mBox[0].z() = DSin( aVMin ) * mRadius;
out_bound.mBox[1].z() = DSin( aVMax ) * mRadius;
}