WaterPhysicsSystem::Edge::EdgeType WaterPhysicsSystem::Edge::getEdgeType() { if (aPosition().y < bPosition().y) { /// Downwards pointing if (aPosition().x < bPosition().x) { return eLeftFloor; } else { return eLeftRoof; } } else { /// Upwards pointing if (aPosition().x < bPosition().x) { return eRightFloor; } else { return eRightRoof; } } }
WaterPhysicsSystem::Edge* WaterPhysicsSystem::Edge::split(Vec2f _point, Boundary* _boundary) { Vertex* anchor = new Vertex(_point, _boundary, true); Edge* edge = new Edge; edge->setA(anchor, bPosition()); edge->setB(b); setB(anchor); return edge; }
QPointF translate( const TernaryPoint& point ) { if ( point.isValid() ) { // the position is calculated by // - first moving along the B-C line to the function that b // selects // - then traversing the selected function until we meet with // the function that A selects (which is a parallel of the B-C // line) QPointF bPosition( 1.0 - point.b(), 0.0 ); QPointF aPosition( point.a() * AxisVector_C_A ); QPointF result( bPosition + aPosition ); return result; } else { qWarning() << "TernaryPoint::translate(TernaryPoint): cannot translate invalid ternary points:" << point; return QPointF(); } }
bPosition operator+ (bPosition& other) { return bPosition(ypos+other.ypos,xpos+other.xpos); }