本文整理汇总了C++中Sphere::SetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Sphere::SetPos方法的具体用法?C++ Sphere::SetPos怎么用?C++ Sphere::SetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sphere
的用法示例。
在下文中一共展示了Sphere::SetPos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetContainerBoundingSphere
void SNPointLight::GetContainerBoundingSphere(Sphere &cSphere)
{
// The sphere has always the 'range' as radius
cSphere.SetRadius(m_fRange);
// The sphere is always within the scene node origin
cSphere.SetPos(GetTransform().GetPosition());
}
示例2: CalculateSphere
/**
* @brief
* Calculates the sphere surrounding the enclosed area
*/
void PlaneSet::CalculateSphere(Sphere &cSphere) const
{
// Init sphere
cSphere.SetPos();
cSphere.SetRadius();
// Find all plane intersection points
Vector3 vD;
Array<Vector3> lstPoints;
for (uint32 nP1=0; nP1<m_lstPlane.GetNumOfElements(); nP1++) {
const Plane &cP1 = m_lstPlane[nP1];
for (uint32 nP2=0; nP2<m_lstPlane.GetNumOfElements(); nP2++) {
const Plane cP2 = m_lstPlane[nP2];
if (nP2 != nP1) {
for (uint32 nP3=0; nP3<m_lstPlane.GetNumOfElements(); nP3++) {
const Plane &cP3 = m_lstPlane[nP3];
if (nP3 != nP1 && nP3 != nP2) {
Vector3 vRes;
if (Intersect::PlanePlanePlane(cP1, cP2, cP3, vRes)) {
lstPoints.Add(vRes);
vD += vRes;
}
}
}
}
}
}
// Get sphere position and radius
if (lstPoints.GetNumOfElements()) {
vD /= static_cast<float>(lstPoints.GetNumOfElements());
cSphere.SetPos(vD);
float fMaxLength = 0.0f;
for (uint32 i=0; i<lstPoints.GetNumOfElements(); i++) {
const Vector3 &vP = lstPoints[i];
const float fLength = (vP-vD).GetLength();
if (fLength > fMaxLength)
fMaxLength = fLength;
}
cSphere.SetRadius(fMaxLength);
}
}
示例3: Start
// Load assets
bool ModuleSceneIntro::Start()
{
LOG("Loading Intro assets");
bool ret = true;
App->camera->Move(vec3(1.0f, 1.0f, 0.0f));
App->camera->LookAt(vec3(0, 0, 0));
// TODO 2: Chain few N spheres together to form a snake
Sphere s;
s.SetPos(0, 3, 0);
Sphere s2;
s2.SetPos(4, 3, 0);
PhysBody3D* bodyA = App->physics->AddBody(s);
PhysBody3D* bodyB = App->physics->AddBody(s2);
vec3 vA = { 2, 0, 0 };
vec3 vB = { -2, 0, 0 };
vec3 aA = { 0, 1, 0 };
vec3 aB = { 0, 1, 0 };
App->physics->CreateHingeConstraint(bodyA, bodyB, vA, vB, aA, aB);
/*
for (int i = 0; i < MAX_SNAKE; ++i)
{
s_snake[i] = Sphere(MAX_SNAKE - i);
//s_snake[i].SetPos( MAX_SNAKE - i, 0, MAX_SNAKE + i );
pb_snake[i] = App->physics->AddBody(s_snake[i]);
if (i > 0)
{
App->physics->Create2PointConstraint(pb_snake[i - 1], pb_snake[i], { 0, 0, 1 + s_snake[i - 1].radius }, { 0, 0, -1 - s_snake[i].radius });
}
}
*/
// TODO 4: Chain few N spheres together to form a a bike's sphere
// Be sure to put the right axis
return ret;
}