Add PolyLineT scaled() and offsetted(). #1034

Merged
merged 1 commit into from Oct 21, 2016

Projects

None yet

5 participants

@drewish
Contributor
drewish commented Jul 18, 2015

Following the pattern in RectT adding some methods to return copies rather than modifying in place.

@richardeakin
Collaborator

Seems nice to me to have the congruency. Are we all cool with the name offsetted()? I personally can't think of anything better that follows the existing patterns.

@gaborpapp
Contributor

I think RectT has getOffset() instead of offsetted(). So one of them should change for consistency.

@drewish
Contributor
drewish commented Jul 19, 2015

I tried to follow the pattern as best I could but I'm not really a fan of that name. I'm open to what ever the consensus is.

I'm going to rebase it to pick up the reverse addition.

@drewish drewish commented on an outdated diff Jul 19, 2015
include/cinder/PolyLine.h
@@ -54,10 +54,11 @@ class PolyLineT {
T getPosition( float t ) const;
T getDerivative( float t ) const;
- void scale( const T &scaleFactor, T scaleCenter = T() );
- void offset( const T &offsetBy );
- void reverse();
-
+ void scale( const T &scaleFactor, T scaleCenter = T() );
+ PolyLineT<T> scaled( const T &scaleFactor, T scaleCenter = T() ) const;
+ void offset( const T &offsetBy );
+ PolyLineT<T> offsetted( const T &offsetBy ) const;
+ void reverse();
@drewish
drewish Jul 19, 2015 Contributor

I guess GitHub uses 8 spaces per tab? I'm using 4 per the Contributing guidelines.

@drewish
Contributor
drewish commented Jul 19, 2015

Oh speaking of the Rect class... I'd love to follow it's pattern and add transform() and transformed() methods.

@drewish
Contributor
drewish commented Jul 19, 2015

Ah so looks like transform/transformed will both run into the same precision issues were touched on in #1007. The suggestion there was a freestanding function and I think that might work well for this. It would avoid a lot of issues with trying to get the right precision and dimensions (I believe you'd want to turn vec2 into vec3 and vec3 into vec4 so you could use homogeneous coordinates).

@drewish
Contributor
drewish commented Sep 21, 2015

Any interest in this?

@richardeakin
Collaborator

I think there is, and thanks for contributing this work, however we're sort of in a focus on getting through changes necessary for 0.9.0 release. These are pure additions, so perhaps we should wait to sift through the api choices until 0.9.1-dev begins.

@paulhoux paulhoux added the feature label Dec 17, 2015
@drewish
Contributor
drewish commented Apr 2, 2016

@richardeakin seems like stuff has settled down, mind giving it another look now?

@richardeakin
Collaborator

We'll try to get these looked at very soon, along with your other PolyLine improvements. Personally I'm wrapping up a 3 month project that has been consuming my time for the last few weeks. Thanks again for these contributions..

@andrewfb
Collaborator

Just to be frank, the naming between Rect, Area, PolyLine and Shape2d / Path2d are all in serious need of cleanup and unification, particularly in light of our move to GLM. I'm up for merging this, acknowledging that we're due for a serious, breaking refactor in the near future.

@andrewfb andrewfb merged commit 75e33f8 into cinder:master Oct 21, 2016
@drewish drewish deleted the drewish:polyline-more-ed branch Oct 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment