Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

"true" location of ofPoint after transformations with ofPushMatrix

$
0
0

@Luke_Zeitlin wrote:

is there any simple way to retrieve the actual location, as it is drawn to the screen, of a ofPoint that has been defined after a series of transformations using ofPushMatrix?

I want to use the point to draw to an an fbo, but it's .x and .y values are relative to the transformations of the last pushed matrix.

Here is why I want it, for clarification. This class is recursive and I want the point at m_nextAxis at the end of the chain in order to draw it to an fbo.

Circle::Circle(ofPoint axis, double rad, int hz, int numberOfCircles, float radDivisor)
: m_axis(axis), m_rad(rad), m_hz(hz), m_numberOfCircles(numberOfCircles), m_radDivisor(radDivisor)
{
    m_circleNumber = counter++;
    m_nextAxis = ofPoint(0, m_rad);
    ofPushMatrix();
    ofTranslate(m_axis);
    ofRotateZ(ofGetFrameNum());
    makeCircles();
    ofPopMatrix();
}

void Circle::makeCircles()
{
    ofCircle(0, 0, m_rad);
    ofLine(0, 0, 0, m_rad);

    if(m_circleNumber < m_numberOfCircles - 1)
    {
        Circle(m_nextAxis, m_rad / m_radDivisor, 10, m_numberOfCircles, m_radDivisor);
    }
    else if(m_circleNumber == m_numberOfCircles - 1)
    {
        ofCircle(m_nextAxis, 3);
    }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles