Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Angle Literals Too...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stephen Chin  
View profile  
 More options Jan 1 2011, 4:53 pm
From: Stephen Chin <st...@widgetfx.org>
Date: Sat, 01 Jan 2011 13:53:19 -0800
Local: Sat, Jan 1 2011 4:53 pm
Subject: Angle Literals Too...
I finished off the implementation of Angle literals, which was partially
done in the previous check-in.

Here is the changelist in case you are interested in reviewing the
changes (although remember most of the work was done in the previous
check-in):
http://code.google.com/p/visage/source/detail?r=0164367eb49f5f2c1efcf...

And here is a little bit about Angle literals:
Angle instances can be specified as degrees, radians, or turns.  For
precise calculations, they are stored in the given unit type as a double
value.

Angles can be easily created using angle literals; for example, a 90
degree Angle instance can be defined in several ways:
Angle a = 90deg;
Angle a = .25turn;
Angle a = Angle.valueOf(Math.PI / 2, AngleUnit.RADIAN);</pre></code>

Angle instances are immutable, and are therefore replaced rather than
modified.  To create a new Angle instance, either use a time literal, or
use the Angle.valueOf(value, unit) factory method.

Angles support operator overloading of all the usual suspects (+, -, *,
/, etc.)  They also have a custom formatter to let you specify precision.

Happy New Year!

Cheers,
--
--Steve
blog: http://steveonjava.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Josh Marinacci  
View profile  
 More options Jan 3 2011, 7:46 pm
From: Josh Marinacci <jos...@marinacci.org>
Date: Mon, 3 Jan 2011 16:46:25 -0800
Local: Mon, Jan 3 2011 7:46 pm
Subject: Re: [visage-dev] Angle Literals Too...
This is awesome stuff. How much is implemented in the parser and how much is a Java api? I may have to steal this for Leonardo, since it needs unit and angle support soon.

- Josh

On Jan 1, 2011, at 1:53 PM, Stephen Chin wrote:

Blasting forth in three part harmony!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen Chin  
View profile  
 More options Jan 6 2011, 1:02 am
From: Stephen Chin <st...@widgetfx.org>
Date: Thu, 06 Jan 2011 01:02:33 -0500
Local: Thurs, Jan 6 2011 1:02 am
Subject: Re: [visage-dev] Angle Literals Too...
The enum classes (LengthUnit, AngleUnit) are straight Java Enums and
ripe for the taking.  The literal classes (Color, Length, and Angle) are
all implemented as Visage classes.  Doing a straight conversion to Java
would not be hard at all, and would save you the trouble of doing a
clean room implementation of the color algorithms and length conversions
from scratch (which is what I had to do).

I also kept the license as New BSD to promote code sharing, so you are
free to take those classes and reuse/convert them for Leonardo.  In fact
I encourage you to do so, because that makes the job of wrapping
Leonardo with Visage that much easier!  :)

What you are a not getting is the literal syntax support.  You would
need to use the Java constructors to create objects instead.  For example:
Color.rgb(16, 16, 16)
instead of #0F0F0F
or
Length.valueOf(16, LengthUnit.CENTIMETERS)
rather than 16cm

Although this is the unique value proposition of Visage...  we can add
to the language to make things simpler and more elegant than you can do
purely with Java APIs.

Here is a link to the right folder in the source tree to get you started:
http://code.google.com/p/visage/source/browse/#hg%2Fsrc%2Fshare%2Fcla...

Cheers,
--Steve

On 1/3/11 7:46 PM, Josh Marinacci wrote:

--
--Steve
blog: http://steveonjava.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »