本文整理汇总了C++中Point3::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3::set方法的具体用法?C++ Point3::set怎么用?C++ Point3::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Intersect
bool Triangle::Intersect(Ray &ray,Point3 &hitPoint)
{
vector3 e1 = m_Vertex[1] - m_Vertex[0];
vector3 e2 = m_Vertex[2] - m_Vertex[0];
vector3 q = ray.direction.cross(e2);
float a = e1.dot(q);
if(abs(a)<0.001)
{
hitPoint.set(Point3(0,0,0));
return false;
}
float f = 1/a;
vector3 s = ray.position - m_Vertex[0];
float u = f * s.dot(q);
if(u<0.0)
{
hitPoint.set(Point3(0,0,0));
return false;
}
vector3 r = s.cross(e1);
float v = f * ray.direction.dot(r);
if(v<0.0||u+v > 1.0)
{
hitPoint.set(Point3(0,0,0));
return false;
}
float t = f * e2.dot(r);
for(int i =0;i<3;i++)
{
hitPoint.cell[i] = ray.position.cell[i] + t * ray.direction.cell[i];
}
return true;
}
示例2: assert
REAL GarlandMeasurer<THEMesh>::collapse_cost(
TEdge* e, Point3<REAL>& v, Vector3<REAL>& u)
{
assert( vQuad_.count(e->he_->headVtx_) &&
vQuad_.count(e->he_->tailVtx_) );
_VtxQuadric m = vQuad_[e->he_->headVtx_] +
vQuad_[e->he_->tailVtx_];
Matrix3<REAL> invQ;
if ( m.Q.inverse(invQ) >= 0 )
{
Vector3<REAL> vv = invQ*m.b;
v.set(vv.x, vv.y, vv.z);
u.zero();
return vv.dot(m.Q*vv) - 2.*m.b.dot(vv) + m.d;
}
// use head vertex
Vector3<REAL> vv = e->he_->headVtx_->pos_;
REAL e0 = vv.dot(m.Q*vv) - 2.*m.b.dot(vv);
// use tail vertex
vv = e->he_->tailVtx_->pos_;
REAL e1 = vv.dot(m.Q*vv) - 2.*m.b.dot(vv);
if ( e0 > e1 )
{
e0 = e1;
v = e->he_->tailVtx_->pos_;
}
else
{
v = e->he_->headVtx_->pos_;
}
vv = (e->he_->headVtx_->pos_ + e->he_->tailVtx_->pos_)*0.5;
e1 = vv.dot(m.Q*vv) - 2.*m.b.dot(vv);
if ( e1 < e0 )
{
v = vv;
return e1 + m.d;
}
return e0 + m.d;
}