本文整理汇总了C++中Boundary::setRight方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::setRight方法的具体用法?C++ Boundary::setRight怎么用?C++ Boundary::setRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boundary
的用法示例。
在下文中一共展示了Boundary::setRight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addFinalisedVertex
void WaterPhysicsSystem::addFinalisedVertex(Vertex* _vertex, Edge* _edge, bool _leftEdge)
{
Vec2f a = _vertex->position;
Vec2f b;
Vertex* left;
Vertex* right;
Vertex** unsetVertex;
Boundary* boundary = _vertex->getBoundary();
if (boundary == nullptr)
{
boundary = new Boundary(this);
boundaries.push_back(boundary);
}
if (_leftEdge)
{
b = a + Vec2f(500, 0);
left = _vertex;
unsetVertex = &right;
boundary->setLeft(_vertex);
}
else
{
b = a - Vec2f(500, 0);
right = _vertex;
unsetVertex = &left;
boundary->setRight(_vertex);
}
Edge* opposingEdge = findIntersectingEdge(a, &b, _edge);
if (opposingEdge)
{
*unsetVertex = new Vertex(b, nullptr, true);
}
else
{
*unsetVertex = nullptr;
}
if (left)
boundary->setLeft(left);
if (right)
boundary->setRight(right);
}
示例2: addFinalisedEdge
void WaterPhysicsSystem::addFinalisedEdge(Edge* _edge)
{
edges.push_back(_edge);
Edge::EdgeType type = _edge->getEdgeType();
bool leftEdge;
if (type == Edge::eLeftFloor || type == Edge::eLeftRoof)
{
leftEdge = true;
}
else
{
leftEdge = false;
}
addFinalisedVertex(_edge->getA(), _edge, leftEdge);
addFinalisedVertex(_edge->getB(), _edge, leftEdge);
// for (Boundary* boundary = boundaries.front(); boundary; boundary = boundary->getNextObject())
for (unsigned int i = 0; i != boundaries.size(); i++)
{
Boundary* boundary = boundaries[i];
if (boundary)
try
{
Vec2f position = intersectionPosition(_edge->aPosition(), _edge->bPosition(), boundary->getLeftPosition(), boundary->getRightPosition());
Vertex* vertex = new Vertex(position, nullptr, true);
if (leftEdge)
{
//assert(boundary->getLeft() == nullptr);
boundary->setLeft(vertex);
}
else
{
// assert(boundary->getRight() == nullptr);
boundary->setRight(vertex);
}
}
catch (int i)
{}
}
/*
edges.push_back(_edge);
Vec2f a = _edge->aPosition();
Vertex* vertex = _edge->getA();
bool jump = true;
goto ACTUAL_START;
START:
vertex = _edge->getB();
jump = false;
ACTUAL_START:
Vec2f b;
Edge::EdgeType type = _edge->getEdgeType();
bool leftEdge;
if (type == Edge::eLeftFloor | type == Edge::eLeftRoof)
{
b = a + Vec2f(500, 0);
leftEdge = true;
}
else
{
b = a - Vec2f(500, 0);
leftEdge = false;
}
Edge* opposingEdge = findIntersectingEdge(a, &b, _edge);
if (opposingEdge)
{
Vec2f a2 = opposingEdge->aPosition();
Vec2f b2 = a2 + Vec2f((leftEdge)?-500:500,0);
Edge* opposingOpposingEdge = findIntersectingEdge(a2, &b2, opposingEdge);
if (opposingOpposingEdge == _edge)
{
Edge* selfSplit = _edge->split(b2, nullptr);
edges.push_back(selfSplit);
}
// else
{
a2 = opposingEdge->bPosition();
b2 = a2 + Vec2f((leftEdge)?-500:500,0);
opposingOpposingEdge = findIntersectingEdge(a2, &b2, opposingEdge);
if (opposingOpposingEdge == _edge)
{
Edge* selfSplit = _edge->split(b2, nullptr);
edges.push_back(selfSplit);
}
}
Edge* newEdge = opposingEdge->split(b, nullptr);
edges.push_back(newEdge);
}
if (jump)
{
a = _edge->bPosition();
goto START;
}*/
}