本文整理汇总了C++中IStack类的典型用法代码示例。如果您正苦于以下问题:C++ IStack类的具体用法?C++ IStack怎么用?C++ IStack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bezier_subpatch_intersect
int BicubicPatch::bezier_subpatch_intersect(const BasicRay &ray, const ControlPoints *Patch, DBL u0, DBL u1, DBL v0, DBL v1, IStack& Depth_Stack, TraceThreadData *Thread)
{
int cnt = 0;
TripleVector3d V1;
DBL u, v, Depth;
DBL uu[3], vv[3];
Vector3d P, N;
Vector2d UV;
Vector2d uv_point, tpoint;
V1[0] = (*Patch)[0][0];
V1[1] = (*Patch)[0][3];
V1[2] = (*Patch)[3][3];
uu[0] = u0; uu[1] = u0; uu[2] = u1;
vv[0] = v0; vv[1] = v1; vv[2] = v1;
if (intersect_subpatch(ray, V1, uu, vv, &Depth, P, N, &u, &v))
{
if (Clip.empty() || Point_In_Clip(P, Clip, Thread))
{
/* transform current point from uv space to texture space */
uv_point[0] = v;
uv_point[1] = u;
Compute_Texture_UV(uv_point, ST, tpoint);
UV[U] = tpoint[0];
UV[V] = tpoint[1];
Depth_Stack->push(Intersection(Depth, P, N, UV, this));
cnt++;
}
}
V1[1] = V1[2];
V1[2] = (*Patch)[3][0];
uu[1] = uu[2]; uu[2] = u1;
vv[1] = vv[2]; vv[2] = v0;
if (intersect_subpatch(ray, V1, uu, vv, &Depth, P, N, &u, &v))
{
if (Clip.empty() || Point_In_Clip(P, Clip, Thread))
{
/* transform current point from uv space to texture space */
uv_point[0] = v;
uv_point[1] = u;
Compute_Texture_UV(uv_point, ST, tpoint);
UV[U] = tpoint[0];
UV[V] = tpoint[1];
Depth_Stack->push(Intersection(Depth, P, N, UV, this));
cnt++;
}
}
return (cnt);
}
示例2: stackCheck
void stackCheck(IStack<int> &stack){
cout << "Testing stack interface:" << endl;
for (int i = 0; i < 3; i++){
cout << " pushing value: " << i << endl;
stack.push(i);
}
while(stack.size()){
cout << " popped value: " << stack.pop() << endl;
}
}
示例3: All_Intersections
bool Torus::All_Intersections(const Ray& ray, IStack& Depth_Stack, SceneThreadData *Thread)
{
int i, max_i, Found;
DBL Depth[4];
VECTOR IPoint;
Found = false;
if ((max_i = Intersect(ray, Depth, Thread)) > 0)
{
for (i = 0; i < max_i; i++)
{
if ((Depth[i] > DEPTH_TOLERANCE) && (Depth[i] < MAX_DISTANCE))
{
VEvaluateRay(IPoint, ray.Origin, Depth[i], ray.Direction);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(Depth[i], IPoint, this));
Found = true;
}
}
}
}
return(Found);
}
示例4: All_Intersections
bool Plane::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
DBL Depth;
VECTOR IPoint;
if (Intersect(ray, &Depth, Thread))
{
VEvaluateRay(IPoint, ray.Origin, Depth, ray.Direction);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(Depth,IPoint,this));
return(true);
}
}
return(false);
}
示例5: All_Intersections
bool Plane::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
DBL Depth;
Vector3d IPoint;
if (Intersect(ray, &Depth, Thread))
{
IPoint = ray.Evaluate(Depth);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(Depth,IPoint,this));
return(true);
}
}
return(false);
}
示例6: test_hit
bool Lathe::test_hit(const BasicRay &ray, IStack& Depth_Stack, DBL d, DBL w, int n, TraceThreadData *Thread)
{
Vector3d IPoint;
if ((d > DEPTH_TOLERANCE) && (d < MAX_DISTANCE))
{
IPoint = ray.Evaluate(d);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(d, IPoint, this, n, w));
return(true);
}
}
return(false);
}
示例7: insert_hit
bool Superellipsoid::insert_hit(const BasicRay &ray, DBL Depth, IStack& Depth_Stack, TraceThreadData *Thread)
{
Vector3d IPoint;
if ((Depth > DEPTH_TOLERANCE) && (Depth < MAX_DISTANCE))
{
IPoint = ray.Evaluate(Depth);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(Depth, IPoint, this));
return(true);
}
}
return(false);
}
示例8: test_hit
bool Sor::test_hit(const BasicRay &ray, IStack& Depth_Stack, DBL d, DBL k, int t, int n, TraceThreadData *Thread)
{
Vector3d IPoint;
if ((d > DEPTH_TOLERANCE) && (d < MAX_DISTANCE))
{
IPoint = ray.Evaluate(d);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
/* is the extra copy of d redundant? */
Depth_Stack->push(Intersection(d, IPoint, this, t, n, k));
return(true);
}
}
return(false);
}
示例9: All_Intersections
bool Lemon::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
bool Intersection_Found;
int cnt, i;
Vector3d Real_Normal;
Vector3d Real_Pt,INormal;
LEMON_INT I[4];
Vector3d P,D;
DBL len;
Thread->Stats()[Ray_Lemon_Tests]++;
MInvTransPoint(P, ray.Origin, Trans);
MInvTransDirection(D, ray.Direction, Trans);
len = D.length();
D /= len;
Intersection_Found = false;
if ((cnt = Intersect(P, D, I, Thread)) != 0)
{
for (i = 0; i < cnt; i++)
{
Real_Pt = ray.Origin + I[i].d/len * ray.Direction;
if (Clip.empty() || Point_In_Clip(Real_Pt, Clip, Thread))
{
INormal = I[i].n;
MTransNormal(Real_Normal, INormal, Trans);
Real_Normal.normalize();
Depth_Stack->push(Intersection(I[i].d/len,Real_Pt,Real_Normal,this));
Intersection_Found = true;
}
}
}
if(Intersection_Found)
{
Thread->Stats()[Ray_Lemon_Tests_Succeeded]++;
}
return (Intersection_Found);
}
示例10: All_Intersections
bool Triangle::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
DBL Depth;
Vector3d IPoint;
Thread->Stats()[Ray_Triangle_Tests]++;
if (Intersect(ray, &Depth))
{
Thread->Stats()[Ray_Triangle_Tests_Succeeded]++;
IPoint = ray.Evaluate(Depth);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(Depth,IPoint,this));
return(true);
}
}
return(false);
}
示例11: All_Intersections
bool SpindleTorus::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
int i, max_i, Found;
DBL Depth[4];
Vector3d IPoint;
Found = false;
if ((max_i = Intersect(ray, Depth, Thread)) > 0)
{
for (i = 0; i < max_i; i++)
{
if ((Depth[i] > DEPTH_TOLERANCE) && (Depth[i] < MAX_DISTANCE))
{
IPoint = ray.Evaluate(Depth[i]);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
// To test whether the point is on the spindle,
// we test whether it is inside a sphere around the origin going through the spindle's tips.
Vector3d P;
MInvTransPoint(P, IPoint, Trans);
bool onSpindle = (P.lengthSqr() < mSpindleTipYSqr);
bool validIntersection = (onSpindle ? (mSpindleMode & SpindleVisible)
: (mSpindleMode & NonSpindleVisible));
if (validIntersection)
{
Depth_Stack->push(Intersection(Depth[i], IPoint, this, P, onSpindle));
Found = true;
}
}
}
}
}
return(Found);
}
示例12: All_Intersections
bool Disc::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
int Intersection_Found;
DBL Depth;
Vector3d IPoint;
Intersection_Found = false;
Thread->Stats()[Ray_Disc_Tests]++;
if (Intersect(ray, &Depth))
{
Thread->Stats()[Ray_Disc_Tests_Succeeded]++;
IPoint = ray.Evaluate(Depth);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(Depth,IPoint,this));
Intersection_Found = true;
}
}
return (Intersection_Found);
}
示例13: All_Intersections
bool Cone::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
int Intersection_Found, cnt, i;
Vector3d IPoint;
CONE_INT I[4];
Intersection_Found = false;
if ((cnt = Intersect(ray, I, Thread)) != 0)
{
for (i = 0; i < cnt; i++)
{
IPoint = ray.Evaluate(I[i].d);
if (Clip.empty() || Point_In_Clip(IPoint, Clip, Thread))
{
Depth_Stack->push(Intersection(I[i].d,IPoint,this,I[i].t));
Intersection_Found = true;
}
}
}
return (Intersection_Found);
}
示例14: calculate
int CalcStack::calculate(string const &inputString)
{
IStack<int> *stack = new LinkedStack<int>();
vector<string> tokens = separate(inputString);
for(const string &token : tokens)
{
if (isOperator(token))
{
int second = stack->pop();
int first = stack->pop();
stack->push(doOperation(token[0], first, second));
}
else if (isNumber(token))
{
stack->push(stoi(token));
}
}
int result = stack->top();
delete stack;
return result;
}
示例15: MInvTransDirection
bool Fractal::All_Intersections(const Ray& ray, IStack& Depth_Stack, TraceThreadData *Thread)
{
bool Intersection_Found;
bool LastIsInside = false;
bool CurrentIsInside, NextIsInside;
DBL Depth, Depth_Max;
DBL Dist, Dist_Next, LenSqr, LenInv;
Vector3d IPoint, Mid_Point, Next_Point, Real_Pt;
Vector3d Real_Normal, F_Normal;
Vector3d Direction;
BasicRay New_Ray;
Thread->Stats()[Ray_Fractal_Tests]++;
Intersection_Found = false;
/* Get into Fractal's world. */
if (Trans != NULL)
{
MInvTransDirection(Direction, ray.Direction, Trans);
LenSqr = Direction.lengthSqr();
if (LenSqr == 0.0)
{
return (false);
}
if (LenSqr != 1.0)
{
LenInv = 1.0 / sqrt(LenSqr);
Direction *= LenInv;
}
else
LenInv = 1.0;
New_Ray.Direction = Direction;
MInvTransPoint(New_Ray.Origin, ray.Origin, Trans);
}
else
{
Direction = ray.Direction;
New_Ray = ray;
LenInv = 1.0;
}
/* Bound fractal. */
if (!F_Bound(New_Ray, this, &Depth, &Depth_Max))
{
return (false);
}
if (Depth_Max < Fractal_Tolerance)
{
return (false);
}
if (Depth < Fractal_Tolerance)
{
Depth = Fractal_Tolerance;
}
/* Jump to starting point */
Next_Point = New_Ray.Origin + Direction * Depth;
CurrentIsInside = D_Iteration(Next_Point, this, Direction, &Dist, Thread->Fractal_IStack);
/* Light ray starting inside ? */
if (CurrentIsInside)
{
Next_Point += (2.0 * Fractal_Tolerance) * Direction;
Depth += 2.0 * Fractal_Tolerance;
if (Depth > Depth_Max)
{
return (false);
}
CurrentIsInside = D_Iteration(Next_Point, this, Direction, &Dist, Thread->Fractal_IStack);
}
/* Ok. Trace it */
while (Depth < Depth_Max)
{
/*
* Get close to the root: Advance with Next_Point, keeping track of last
* position in IPoint...
*/
while (1)
{
if (Dist < Precision)
Dist = Precision;
//.........这里部分代码省略.........