本文整理汇总了C++中BoxVolume::isOnSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxVolume::isOnSurface方法的具体用法?C++ BoxVolume::isOnSurface怎么用?C++ BoxVolume::isOnSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxVolume
的用法示例。
在下文中一共展示了BoxVolume::isOnSurface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char **argv) {
Real32 ent, ex;
int i;
//Lines:
const int nlines = 10;
Line lines[nlines];
Pnt3f pnts[nlines * 2] = {
Pnt3f(0,0,0), Pnt3f(0,1,0),
Pnt3f(0,0,0), Pnt3f(2,1,0),
Pnt3f(2,0,0), Pnt3f(2,1,0),
Pnt3f(-2,0,0), Pnt3f(0,2,0),
Pnt3f(-4,2,0), Pnt3f(0,2,0),
Pnt3f(-3,0,0), Pnt3f(-2,1,0),
Pnt3f(3,4,0), Pnt3f(1,3,0),
Pnt3f(-1,0,0), Pnt3f(-1,1,0),
Pnt3f(-4,0,0), Pnt3f(-3,1,0),
Pnt3f(-4,6,0), Pnt3f(0,6,0)
};
for ( i = 0; i < nlines; i++ )
lines[i].setValue( pnts[i*2], pnts[i*2+1] );
BoxVolume b;
float xmin, ymin, zmin, xmax, ymax, zmax;
xmin = 0;
ymin = 0.5;
zmin = 0;
xmax = 1;
ymax = .5;
zmax = 1;
b.setBounds(xmin, ymin, zmin, xmax, ymax, zmax);
std::cout << std::endl;
b.dump();
std::cout << std::endl;
for ( i = 0 ; i < nlines; i++ )
{
std::cout << "Line: (" << lines[i].getPosition() << ") ("
<< lines[i].getDirection() << ")" << std::endl;
bool res = lines[i].intersect( b, ent, ex );
Pnt3f ep = lines[i].getPosition() + ent * lines[i].getDirection(),
xp = lines[i].getPosition() + ex * lines[i].getDirection();
std::cout << "Result: " << res;
if ( res )
{
std::cout << " enter " << ent << "=(" << ep << ") ";
bool es = ( b.isOnSurface( ep ) || b.intersect( ep ) ),
xs = b.isOnSurface( xp );
if ( ( res && es ) || !res ) std::cout << "ok";
else std::cout << "**BAD**";
std::cout << "; exit " << ex << "=(" << xp << ") ";
if ( ( res && xs ) || !res ) std::cout << "ok";
else std::cout << "**BAD**";
}
std::cout << std::endl;
}
return 0;
SphereVolume s;
float radius;
Vec3f center;
center[0] = 0;
center[1] = 0;
center[2] = 0;
radius = 1;
s.setCenter(center);
s.setRadius(radius);
std::cout << std::endl;
s.dump();
std::cout << std::endl;
for ( i = 0 ; i < nlines; i++ )
{
std::cout << "Line: (" << lines[i].getPosition() << ") ("
<< lines[i].getDirection() << ")" << std::endl;
//.........这里部分代码省略.........