openframeworks / openframeworks/openFrameworks

ofNode::orbit behaving in curious ways when parented

Open
#4,962 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

I seem to have discovered some strange behaviour with parented ofNodes, whilst attempting to write some unit tests for ofNode so we may guard against regressions if moving to glm.

This is the code used to render the below graph:

mNode = ofNode();
mNode1 = ofNode();
mNode2 = ofNode();

mNode2.setParent(mNode);
mNode.orbit(90, 0, 100);

// at this point i would expect mNode2 to be congruent with its parent node
mNode2.truck(-100.f);

// now i would expect mNode2 to be 100 units behind its parent node on its x axis
// and i would expect mNode1 to store the current state of mNode2, so that we
// can display it later
mNode1 = mNode2;

// now i would expect mNode 2 to have been rotated 90 deg around mNode, which is the red node
mNode2.orbit(90, 0, 100, mNode);

Here's a screengrab of what's currently been rendered:

testorbit_debug 2016-03-01 19-18-42-167

Somehow, I would expect the blue node to be not further away than 100 units from the red node (its parent and rotation center) - but that's not happening.

Here's a gist:

https://gist.github.com/tgfrerer/525e219d55a39f718b23

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the parented ofNode scenario from the issue and the linked gist, focusing on setParent, orbit, truck, and copying mNode2. Compare the rendered positions with the stated expectation that the orbiting node remains 100 units from its parent, then add regression coverage for the observed transformation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.