ofNode::scale including a negatie value changes when calling ofNode::setLocalTransformMatrix

Hello.

I may found ofNode bug.

Is this a bug? Or am I misunderstanding something?

↓press space bar

class ofApp : public ofBaseApp {
    
    ofEasyCam cam;
    array<ofNode, 8> nodes;
public:
    void setup(){
        
        for(int i=0; i<8; i++) {
            int x = i%2;
            int y = i/2 %2;
            int z = i/2 /2;
            ofPoint p(x,y,z); // (0,0,0), (0,0,1), (0,1,0), (0,1,1), ...
            p -= 0.5;
            p *= 2;           // (-1,-1,-1), (-1,-1,1), (-1,1,-1), (-1,1,1), ...
            nodes[i].setScale(p);
            nodes[i].setPosition(p * 50);
        }
    }
    void update() {
    }
    void draw(){
        cam.begin();
        ofDrawAxis(300);
        for(auto& n : nodes) {
            n.draw();
            ofDrawArrow(n.getPosition(), n.getPosition() + n.getScale()*100, 10);
        }
        cam.end();
    }
    void keyPressed(int key ) {
        if(key == ' ') {
            for(auto& n : nodes) {
                auto m = n.getLocalTransformMatrix();
                
                ofPoint scale0 = n.getScale();
                n.setTransformMatrix(m);
                ofPoint scale1 = n.getScale();
                
                if(scale0 != scale1) {
                    ofLog() << "scale changed " << scale0  << " : " << scale1;
                }
            }
        }
    }
};

↓log

[notice ] scale changed 1, -1, -1 : 1, 1, 1
[notice ] scale changed -1, 1, -1 : 1, 1, 1
[notice ] scale changed 1, 1, -1 : -1, -1, -1
[notice ] scale changed -1, -1, 1 : 1, 1, 1 
[notice ] scale changed 1, -1, 1 : -1, -1, -1
[notice ] scale changed -1, 1, 1 : -1, -1, -1

P.S.
of_0.9.2 osx

what are you trying to do with this?

n.getPosition() + n.getScale()

?

If getScale() returns a float, I do not understand how you want to add a scalar to a vec3

It should not be ?

n.getPosition() * n.getScale()
n.getPosition() + n.getScale()

This is only for visualizing scale.
getScale() returns ofVec3f.

I think it is something strange that ofNode::scale is changing when setting its own transformation matrix to the ofNode.

hi yes, setLocalTranformMatrix was buggy and has been removed in recent OF versions cause there’s not a 100% reliable way to decompose a matrix in it’s components

OK
I noticed that I forgot to write a version, so I added it.

Thank you!