Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AngularVelocity a derivative of Angle #173

Merged
merged 2 commits into from
Jan 28, 2017

Conversation

shadaj
Copy link
Contributor

@shadaj shadaj commented Jan 28, 2017

This makes it possible to multiply AngularVelocity by Time to get Angle, and divide Angle by Time to get an AngularVelocity.

@derekmorr derekmorr self-assigned this Jan 28, 2017
@derekmorr
Copy link
Collaborator

Hi,

Thanks for the PR. I put a few minor comments in-line.

Would you also consider updating the tests? I'm thinking space/AngleSpec.scala. I'm wondering if space/SpaceChecks.scala should also be updated to have a general "AngularVelocity = Angle/Time" property.

-derek

@shadaj shadaj force-pushed the angular-velocity-integrals branch 2 times, most recently from c048917 to 8a77066 Compare January 28, 2017 01:22
@shadaj
Copy link
Contributor Author

shadaj commented Jan 28, 2017

I've added unit tests in AngleSpec, AngularVelocitySpec, and SpaceChecks that verify that transformations between Angle and AngularVelocity work correctly.

I can't see the in-line comments, however. Can you resubmit them to GitHub?

@derekmorr
Copy link
Collaborator

Thanks for adding the tests, and the quick turn around.

My comments were around using Degrees and DegreesPerSecond in AngularVelocity and Angle, respectively. We try to use SI units when possible, meaning Radians in this case. It looks like you changed AngularVelocity.scala to use Radians in the updated PR, but Angle.scala still uses DegreesPerSecond on line 39. Could you change it to use RadiansPerSecond?

Other than that, this looks good.

-derek

@shadaj
Copy link
Contributor Author

shadaj commented Jan 28, 2017

Awesome! I updated Angle.scala to use RadiansPerSecond.

@@ -34,6 +35,10 @@ final class Angle private (val value: Double, val unit: AngleUnit)
def tan = math.tan(toRadians)
def asin = math.asin(toRadians)
def acos = math.acos(toRadians)

protected def timeDerived: AngularVelocity = RadiansPerSecond(toRadians)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why on AngularVelocity the protected methods are [squants] protected but not in Angle

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a timeDerived value. We're not consistent on those.

The other values in this PR are timeIntegrated values, which we're pretty good at making protected[squants].

timeDerived is all over the place, though.

Good question. We don't seem to be consistent in that.

In Velocity, the timeDerived member is public (line 31).
In Information, the timeDerived member is protected (line 27).
In LuminousEnergy, the timeDerived member is protected (line 25).
etc.

@cquiroz
Copy link
Collaborator

cquiroz commented Jan 28, 2017

Thanks for the PR, it looks very good to me

def dimension = AngularVelocity

def toRadiansPerSecond = to(RadiansPerSecond)
def toDegreesPerSecond = to(DegreesPerSecond)
def toGradsPerSecond = to(GradsPerSecond)
def toTurnsPerSecond = to(TurnsPerSecond)

protected[squants] def timeIntegrated: Angle = Degrees(toDegreesPerSecond)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally use SI units inside the library. Should this be changed to use radians?

@@ -34,6 +35,10 @@ final class Angle private (val value: Double, val unit: AngleUnit)
def tan = math.tan(toRadians)
def asin = math.asin(toRadians)
def acos = math.acos(toRadians)

protected def timeDerived: AngularVelocity = DegreesPerSecond(toDegrees)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about radians.

@@ -34,6 +35,10 @@ final class Angle private (val value: Double, val unit: AngleUnit)
def tan = math.tan(toRadians)
def asin = math.asin(toRadians)
def acos = math.acos(toRadians)

protected def timeDerived: AngularVelocity = RadiansPerSecond(toRadians)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a timeDerived value. We're not consistent on those.

The other values in this PR are timeIntegrated values, which we're pretty good at making protected[squants].

timeDerived is all over the place, though.

Good question. We don't seem to be consistent in that.

In Velocity, the timeDerived member is public (line 31).
In Information, the timeDerived member is protected (line 27).
In LuminousEnergy, the timeDerived member is protected (line 25).
etc.

@derekmorr derekmorr merged commit 90ac093 into typelevel:master Jan 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants