[of-dev] glm

Naoto Hieda micuat at gmail.com
Tue Mar 1 07:17:57 PST 2016


It seems a good idea, but I always find "ofSomething" naming convention is
lengthy compared to Processing or Cinder (afaik Cinder uses namespace). For
me namespace is more intuitive and cleaner, but I don't know which is
better from teaching perspectives where namespace can be a bit confusing
for beginners.

-Naoto

2016-03-01 10:09 GMT-05:00 Christopher P. Baker <me at christopherbaker.net>:

> Also a nice place to use ofIsFloatEqual() :)
>
>
> ---
> http://christopherbaker.net
>
> On Tue, Mar 1, 2016 at 9:06 AM, Christopher P. Baker <
> me at christopherbaker.net> wrote:
>
>> OK.  I'm convinced.  That's pretty nice and would be pretty enjoyable to
>> teach :)
>>
>>
>> ---
>> http://christopherbaker.net
>>
>> On Tue, Mar 1, 2016 at 9:05 AM, arturo castro <arturo at openframeworks.cc>
>> wrote:
>>
>>> yeah that's it then you can also do things like:
>>>
>>> ofRadians(HALF_PI) == ofDegrees(90)
>>>
>>> or
>>>
>>> ofDegrees(90) + ofRadians(TWO_PI) == ofDegrees(90)
>>>
>>> ...
>>>
>>> On 01.03.2016 02:22, Elliot Woods wrote:
>>> > I like it. I'be had similar feelings in the past that bare floats
>>> aren't
>>> > the best way to go
>>> > Especially if there's just one class ofAngle, constructed using
>>> > ofDegrees and ofRadians (perhaps using float radians as the internal
>>> > storage type)
>>> > On Tue, 1 Mar 2016 at 02:24, arturo castro <arturo at openframeworks.cc>
>>> wrote:
>>> >
>>> >     actually someone already sent a similar PR to glm:
>>> >     https://github.com/g-truc/glm/pull/339 is stalled now so not sure
>>> if
>>> >     it'll ever get merged
>>> >
>>> >     On 29.02.2016 18:10, arturo castro wrote:
>>> >     > I don't think changing everything to radians is a good idea,
>>> breaking
>>> >     > changes that don't break at compile time are really hard to fix.
>>> >     >
>>> >     > also somethings really make more sense in degrees than radians,
>>> like a
>>> >     > camera fov.
>>> >     >
>>> >     > What i propose, and i've been using for a while in some non OF
>>> >     projects,
>>> >     > is something like:
>>> >     >
>>> >     > class ofRadians{
>>> >     >     float angle;
>>> >     >     explicit ofRadians(float angle): angle(angle){}
>>> >     > }
>>> >     >
>>> >     > class ofDegrees{
>>> >     >     float angle
>>> >     >     explicit ofDegrees(float angle): angle(angle){}
>>> >     > }
>>> >     >
>>> >     > void ofSetupPerspective(ofDegrees fov,...)
>>> >     > void ofSetupPerspective(ofRadians fov,...)
>>> >     > void ofRotate(ofDegrees angle);
>>> >     > void ofRotate(ofRadians angle);
>>> >     > ...
>>> >     >
>>> >     > This is as lightweight as passing a float but it allows to
>>> remove any
>>> >     > ambiguity about the unit you are using and even use any of them
>>> >     without
>>> >     > having to worry because they can auto convert to one another.
>>> >     >
>>> >     > The code also becomes much more clear about what unit is being
>>> used.
>>> >     >
>>> >     > I'm not sure what's the process for glm to accept code changes
>>> but
>>> >     i've
>>> >     > seen that they've been going back and forth between degrees and
>>> >     radians
>>> >     > for some functions (right now everything is radians) so it might
>>> be an
>>> >     > api that could make sense for them too
>>> >     >
>>> >     > On 29.02.2016 16:54, Christopher P. Baker wrote:
>>> >     >> +1 for GLM.  I would prefer to move the API to radians without
>>> any
>>> >     >> special ofRadians class etc.  While it made a lot of sense to
>>> use
>>> >     >> degrees at one point since it matches with the older opengl api,
>>> >     with a
>>> >     >> move toward programmable pipeline and eventually vulkan, more
>>> >     often than
>>> >     >> not students will be using lower level math functions with
>>> radians.
>>> >     >> Thus, while to most art / design students degrees might be more
>>> >     >> intuitive, the availability of ofDegToRad() to pass into
>>> radians only
>>> >     >> functions might be enough help in that direction.  A major goal
>>> >     of GLM
>>> >     >> integration is for standards-consistency, so I'd vote that we
>>> should
>>> >     >> also move toward radians and document it like crazy.
>>> >     >>
>>> >     >>
>>> >     >> ---
>>> >     >> http://christopherbaker.net
>>> >     >>
>>> >     >> On Mon, Feb 29, 2016 at 8:30 AM, arturo castro
>>> >     <arturo at openframeworks.cc
>>> >     >> <mailto:arturo at openframeworks.cc
>>> >     <mailto:arturo at openframeworks.cc>>> wrote:
>>> >     >>
>>> >     >>     >
>>> >     >>     > Isn't there an ofRadToDegree and ofDegreesToRads?
>>> >     >>
>>> >     >>     yes, but that doesn't solve the problem of having an API
>>> that
>>> >     uses
>>> >     >>     radians for some things and degrees for others. i mean you
>>> >     can use the
>>> >     >>     conversion functions but it would be better if the api was
>>> more
>>> >     >>     consistent
>>> >     >>     _______________________________________________
>>> >     >>     of-dev mailing list
>>> >     >>     of-dev at dev.openframeworks.cc
>>> >     <mailto:of-dev at dev.openframeworks.cc>
>>> >     <mailto:of-dev at dev.openframeworks.cc
>>> >     <mailto:of-dev at dev.openframeworks.cc>>
>>> >     >>
>>> >
>>> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>>> >     >>
>>> >     >>
>>> >     >>
>>> >     >>
>>> >     >> _______________________________________________
>>> >     >> of-dev mailing list
>>> >     >> of-dev at dev.openframeworks.cc <mailto:
>>> of-dev at dev.openframeworks.cc>
>>> >     >>
>>> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>>> >     >>
>>> >     > _______________________________________________
>>> >     > of-dev mailing list
>>> >     > of-dev at dev.openframeworks.cc <mailto:
>>> of-dev at dev.openframeworks.cc>
>>> >     >
>>> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>>> >     >
>>> >     _______________________________________________
>>> >     of-dev mailing list
>>> >     of-dev at dev.openframeworks.cc <mailto:of-dev at dev.openframeworks.cc>
>>> >     http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > of-dev mailing list
>>> > of-dev at dev.openframeworks.cc
>>> > http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>>> >
>>> _______________________________________________
>>> of-dev mailing list
>>> of-dev at dev.openframeworks.cc
>>> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>>>
>>
>>
>
> _______________________________________________
> of-dev mailing list
> of-dev at dev.openframeworks.cc
> http://dev.openframeworks.cc/listinfo.cgi/of-dev-openframeworks.cc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dev.openframeworks.cc/pipermail/of-dev-openframeworks.cc/attachments/20160301/9252bc79/attachment-0001.htm>


More information about the of-dev mailing list