本文整理汇总了C++中IStack::push方法的典型用法代码示例。如果您正苦于以下问题:C++ IStack::push方法的具体用法?C++ IStack::push怎么用?C++ IStack::push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStack
的用法示例。
在下文中一共展示了IStack::push方法的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: 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);
}
示例3: 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;
}
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: 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);
}
示例15: All_Intersections
//.........这里部分代码省略.........
Thread->Stats()[Ray_Fractal_Tests_Succeeded]++;
return (Intersection_Found);
}
IPoint = Next_Point;
Next_Point += Dist * Direction;
NextIsInside = D_Iteration(Next_Point, this, Direction, &Dist_Next, Thread->Fractal_IStack);
if (NextIsInside != CurrentIsInside)
{
/* Set surface was crossed... */
Depth -= Dist;
break;
}
else
{
Dist = Dist_Next; /* not reached */
}
}
/* then, polish the root via bisection method... */
while (Dist > Fractal_Tolerance)
{
Dist *= 0.5;
Mid_Point = IPoint + Dist * Direction;
LastIsInside = Iteration(Mid_Point, this, Thread->Fractal_IStack);
if (LastIsInside == CurrentIsInside)
{
IPoint = Mid_Point;
Depth += Dist;
if (Depth > Depth_Max)
{
if (Intersection_Found)
Thread->Stats()[Ray_Fractal_Tests_Succeeded]++;
return (Intersection_Found);
}
}
}
if (!CurrentIsInside) /* Mid_Point isn't inside the set */
{
IPoint += Dist * Direction;
Depth += Dist;
Iteration(IPoint, this, Thread->Fractal_IStack);
}
else
{
if (LastIsInside != CurrentIsInside)
{
Iteration(IPoint, this, Thread->Fractal_IStack);
}
}
if (Trans != NULL)
{
MTransPoint(Real_Pt, IPoint, Trans);
Normal_Calc(this, F_Normal, Thread->Fractal_IStack);
MTransNormal(Real_Normal, F_Normal, Trans);
}
else
{
Real_Pt = IPoint;
Normal_Calc(this, Real_Normal, Thread->Fractal_IStack);
}
if (Clip.empty() || Point_In_Clip(Real_Pt, Clip, Thread))
{
Real_Normal.normalize();
Depth_Stack->push(Intersection(Depth * LenInv, Real_Pt, Real_Normal, this));
Intersection_Found = true;
/* If fractal isn't used with CSG we can exit now. */
if (!(Type & IS_CHILD_OBJECT))
{
break;
}
}
/* Start over where work was left */
IPoint = Next_Point;
Dist = Dist_Next;
CurrentIsInside = NextIsInside;
}
if (Intersection_Found)
Thread->Stats()[Ray_Fractal_Tests_Succeeded]++;
return (Intersection_Found);
}