openframeworks / openframeworks/openFrameworks

Feature reuest: extend ofPolyline to scale, rotate and form bounding cubes

Open
#2,172 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core feature section-3D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

In brief: ofPolyline is both 3D and drawable, and should therefore have the traits associated with drawables and 3D objects.

It should have, ideally:

ofPolyline::scale(ofVec3f scaleAmount, ofPoint anchorPoint);
ofPolyline::scale(float scaleAmount, ofPoint anchorPoint);
//anchorPoint can be the center of the bounding box by default

ofPolyline::rotate(ofVec3f angle, ofVec3f axis);
//rotation systems are a matter of taste, there must be a general preference somewhere. I suggest Euler angles by default and an about axis which defaults to (0,0,1)

ofPolyline::getBoundingCube();
//right now getBoundingBox() returns an ofRectangle which isn't a box at all. ofPolylines are 3D

ofPolyline::applyMatrix(ofMatrix4x4 m);
//because some people are just like that, right?

Most of these changes are inspired by 2D masks in After Effects and 3D masks in Flame/Flint/Inferno.

On a side note: right now, ofPolyline::resize() calls vector<ofPoint>::resize() inside it. Polyline is drawable, so I think that's an unhealthy semantic overloading that can be avoided.

I found this issue while extending memo's ofxIldaPoly class, which extends ofPolyline, and as of now contain a lot of the necessary additions.

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 reading the existing ofPolyline implementation, especially resize() and getBoundingBox(), then compare the related additions in the linked ofxIldaPoly class. Clarify the scale, rotation, bounding-cube, matrix, and resize semantics before implementing; done should provide consistent APIs for 3D drawable polylines.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.