Discussion:
[numbers] Making Quaternion a VALJO
Steve Bosman
2018-11-29 08:43:22 UTC
Permalink
Hi

I had a look last night at making Quaternion a VALJO.

I've done the following

* changed the constructors to private and added equivalent of methods.
* added a parse method
* altered equals so that (like Complex) it uses Double.equals - gets round
an edge case where Quaternions with the equivalence of -0 and 0 discovered
while adding tests for hashCode
* added a divide by scalar method
* added a norm2 (square of norm) method
* added some additional unit tests so it should now have 100% coverage

I've raised a pull request, and I have also emailed an ICLA.

I think two convenience divide methods performing qr^{-1} and r^{-1}q for q
and r would be useful, but I couldn't think of nice names for them.

Steve
Gilles
2018-11-29 13:04:23 UTC
Permalink
Hello.
Post by Steve Bosman
Hi
I had a look last night at making Quaternion a VALJO.
I've done the following
* changed the constructors to private and added equivalent of
methods.
* added a parse method
* altered equals so that (like Complex) it uses Double.equals - gets round
an edge case where Quaternions with the equivalence of -0 and 0 discovered
while adding tests for hashCode
* added a divide by scalar method
* added a norm2 (square of norm) method
* added some additional unit tests so it should now have 100%
coverage
Thanks!
Post by Steve Bosman
I've raised a pull request,
I've commented it.
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
[I guess that we have to wait before committing the contribution...]
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and r^{-1}q for q
and r would be useful, but I couldn't think of nice names for them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?


Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Steve Bosman
2018-11-30 14:22:45 UTC
Permalink
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not (yet)
committers." page.
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and r^{-1}q for q
and r would be useful, but I couldn't think of nice names for them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you end up
creating inverse instances and throwing them away a lot and I thought it
would be good to reduce that overhead.

Steve
Gilles
2018-11-30 14:37:46 UTC
Permalink
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not (yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you end up
creating inverse instances and throwing them away a lot and I thought it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...

Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Matt Juntunen
2018-12-01 06:05:31 UTC
Permalink
Hi guys,

FYI, I've been working on a quaternion-related class named QuaternionRotation for commons-geometry (see link below). It includes slerp as well as several other geometry-oriented methods, such as conversion to/from axis-angle representations and creation from basis rotations. It's not quite ready for a merge yet since I still need to finish the Euler angle conversions.

I did not use the Quaternion class from commons-numbers since I wanted to focus solely on using quaternions to represent 3D rotations. I felt like the commons-numbers class was too general for this.

Regards,
Matt


https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>

darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry development by creating an account on GitHub.
github.com




________________________________
From: Gilles <***@harfang.homelinux.org>
Sent: Friday, November 30, 2018 9:37 AM
To: ***@commons.apache.org
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...

Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Gilles
2018-12-01 11:56:34 UTC
Permalink
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from basis
rotations. It's not quite ready for a merge yet since I still need to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.

Some questions:
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from
[Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?

The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example, interpolation
is a purely quaternion-internal operation.

It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in [Geometry]
(for 2D rotations).

Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I
thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Gilles
2018-12-02 02:40:31 UTC
Permalink
Post by Gilles
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It
includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from basis
rotations. It's not quite ready for a merge yet since I still need to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from
[Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example, interpolation
is a purely quaternion-internal operation.
s/second/third/
Post by Gilles
It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in [Geometry]
(for 2D rotations).
Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Matt Juntunen
2018-12-02 19:20:03 UTC
Permalink
Unless anyone objects, I'm going to continue with what I'm working on with QuaternionRotation and create a merge request. That way, we'll at least have a reference implementation and baseline functionality for commons-geometry that we can modify later based on what's decided here.

-Matt
________________________________
From: Gilles <***@harfang.homelinux.org>
Sent: Saturday, December 1, 2018 9:40 PM
To: ***@commons.apache.org
Subject: Re: [Numbers][Geometry] Where to define "quaternion" (Was: Making Quaternion a VALJO)
Post by Gilles
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It
includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from
basis
rotations. It's not quite ready for a merge yet since I still need
to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from
[Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example, interpolation
is a purely quaternion-internal operation.
s/second/third/
Post by Gilles
It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in [Geometry]
(for 2D rotations).
Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Gilles
2018-12-02 20:57:57 UTC
Permalink
Post by Matt Juntunen
Unless anyone objects, I'm going to continue with what I'm working on
I certainly don't object on your working to improve the geometry
code, but wherever that work overlaps with code being worked on
elsewhere (in this case, the "Quaternion" class), then we'd
rather have a discussion happening here first.
Post by Matt Juntunen
with QuaternionRotation and create a merge request. That way, we'll
at
least have a reference implementation and baseline functionality for
commons-geometry that we can modify later based on what's decided
here.
My questions below are a start; I'm waiting for answers.
Code duplication is bad (TM).

Regards,
Gilles
Post by Matt Juntunen
-Matt
________________________________
Sent: Saturday, December 1, 2018 9:40 PM
Making Quaternion a VALJO)
Post by Gilles
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It
includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from
basis
rotations. It's not quite ready for a merge yet since I still need
to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from
[Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example, interpolation
is a purely quaternion-internal operation.
s/second/third/
Post by Gilles
It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in [Geometry]
(for 2D rotations).
Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Matt Juntunen
2018-12-03 03:56:02 UTC
Permalink
I was just thinking from a practical standpoint. My current QuaternionRotation class is still in my working branch for GEOMETRY-14 and so isn't really accessible to anyone. If I can finish it up in its current state (hopefully very soon) and get it merged, then someone else will be able to work with it and blend the functionality with commons-numbers.

Here are some notes on your questions from before:

* Should "QuaternionRotation" inherit from "Quaternion"?

That would work conceptually. The quaternions in the QuaternionRotation class are standard quaternions that meet two other criteria: 1) they are unit length, and 2) their scalar component is greater than or equal to zero (in order to standardize the angles involved). The one sticking point here is that I'm not sure how this fits with the VALJO concept. If we can get this sorted, then this very well may be the best option.

* Should "Quaternion" be defined in [Geometry] (and removed from [Numbers])?

Perhaps. I've certainly only used them to represent 3D rotations. Are there any other use cases from commons-numbers?

* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?

The conversion to rotation matrix and slerp are the best candidates here. The other methods rely on core classes from commons-geometry, namely Vector3D.

One more note: I decided to make a separate package for 3D rotations in my working branch for GEOMETRY-14, so QuaternionRotation is now at https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java.

-Matt
________________________________
From: Gilles <***@harfang.homelinux.org>
Sent: Sunday, December 2, 2018 3:57 PM
To: ***@commons.apache.org
Subject: Re: [Numbers][Geometry] Where to define "quaternion" (Was: Making Quaternion a VALJO)
Post by Matt Juntunen
Unless anyone objects, I'm going to continue with what I'm working on
I certainly don't object on your working to improve the geometry
code, but wherever that work overlaps with code being worked on
elsewhere (in this case, the "Quaternion" class), then we'd
rather have a discussion happening here first.
Post by Matt Juntunen
with QuaternionRotation and create a merge request. That way, we'll
at
least have a reference implementation and baseline functionality for
commons-geometry that we can modify later based on what's decided
here.
My questions below are a start; I'm waiting for answers.
Code duplication is bad (TM).

Regards,
Gilles
Post by Matt Juntunen
-Matt
________________________________
Sent: Saturday, December 1, 2018 9:40 PM
Making Quaternion a VALJO)
Post by Gilles
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It
includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from
basis
rotations. It's not quite ready for a merge yet since I still need
to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from
[Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example, interpolation
is a purely quaternion-internal operation.
s/second/third/
Post by Gilles
It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in [Geometry]
(for 2D rotations).
Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Gilles
2018-12-03 09:31:42 UTC
Permalink
Hi.
Post by Matt Juntunen
I was just thinking from a practical standpoint. My current
QuaternionRotation class is still in my working branch for
GEOMETRY-14
and so isn't really accessible to anyone. If I can finish it up in
its
current state (hopefully very soon) and get it merged, then someone
else will be able to work with it and blend the functionality with
commons-numbers.
Someone else?
Post by Matt Juntunen
* Should "QuaternionRotation" inherit from "Quaternion"?
That would work conceptually. The quaternions in the
QuaternionRotation class are standard quaternions that meet two other
criteria: 1) they are unit length, and 2) their scalar component is
greater than or equal to zero (in order to standardize the angles
involved).
It seems indeed the perfect case for inheritance.
Post by Matt Juntunen
The one sticking point here is that I'm not sure how this
fits with the VALJO concept. If we can get this sorted, then this
very
well may be the best option.
What do you see as a potential issue?
Post by Matt Juntunen
* Should "Quaternion" be defined in [Geometry] (and removed from [Numbers])?
Perhaps. I've certainly only used them to represent 3D rotations. Are
there any other use cases from commons-numbers?
Not within [Numbers], but that's the point of those very low-level
components/modules: they are common utilities used by higher-level
components/libraries/applications.

Given that "QuaternionRotation" is a special case of "Quaternion",
it is logical to keep the latter at a lower-level, namely in
[Numebers], and make [Geometry] depend on it.
Post by Matt Juntunen
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The conversion to rotation matrix and slerp are the best candidates
here. The other methods rely on core classes from commons-geometry,
namely Vector3D.
Is "slerp" applicable to a general "Quaternion", or does it assume
the additional requirements of "QuaternionRotation"?
[Same question applies to all utilities in order to decide where to
define them.]
Post by Matt Juntunen
One more note: I decided to make a separate package for 3D rotations
in my working branch for GEOMETRY-14, so QuaternionRotation is now at
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java.
Could you please update it so that it inherits from "Quaternion"?

Thanks,
Gilles
Post by Matt Juntunen
-Matt
________________________________
Sent: Sunday, December 2, 2018 3:57 PM
Making Quaternion a VALJO)
Post by Matt Juntunen
Unless anyone objects, I'm going to continue with what I'm working on
I certainly don't object on your working to improve the geometry
code, but wherever that work overlaps with code being worked on
elsewhere (in this case, the "Quaternion" class), then we'd
rather have a discussion happening here first.
Post by Matt Juntunen
with QuaternionRotation and create a merge request. That way, we'll
at
least have a reference implementation and baseline functionality for
commons-geometry that we can modify later based on what's decided
here.
My questions below are a start; I'm waiting for answers.
Code duplication is bad (TM).
Regards,
Gilles
Post by Matt Juntunen
-Matt
________________________________
Sent: Saturday, December 1, 2018 9:40 PM
Making Quaternion a VALJO)
Post by Gilles
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It
includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from
basis
rotations. It's not quite ready for a merge yet since I still need
to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from [Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example,
interpolation
is a purely quaternion-internal operation.
s/second/third/
Post by Gilles
It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in [Geometry]
(for 2D rotations).
Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Gilles
2018-12-09 10:21:09 UTC
Permalink
Hello.

After the discussion quote below, the conclusion was to go with
inheritance:
https://issues.apache.org/jira/browse/NUMBERS-80

However, it would make "Quaternion" fail the "ValJO" definition[1]
that mandates that all constructors be private.

Would a protected constructor really be an issue?
[In the case of "Quaternion", the subclass constructor would only
perform additional validation (cf. below for details).]


Thanks,
Gilles

[1] https://blog.joda.org/2014/03/valjos-value-java-objects.html
Post by Gilles
Hi.
Post by Matt Juntunen
I was just thinking from a practical standpoint. My current
QuaternionRotation class is still in my working branch for
GEOMETRY-14
and so isn't really accessible to anyone. If I can finish it up in
its
current state (hopefully very soon) and get it merged, then someone
else will be able to work with it and blend the functionality with
commons-numbers.
Someone else?
Post by Matt Juntunen
* Should "QuaternionRotation" inherit from "Quaternion"?
That would work conceptually. The quaternions in the
QuaternionRotation class are standard quaternions that meet two other
criteria: 1) they are unit length, and 2) their scalar component is
greater than or equal to zero (in order to standardize the angles
involved).
It seems indeed the perfect case for inheritance.
Post by Matt Juntunen
The one sticking point here is that I'm not sure how this
fits with the VALJO concept. If we can get this sorted, then this
very
well may be the best option.
What do you see as a potential issue?
Post by Matt Juntunen
* Should "Quaternion" be defined in [Geometry] (and removed from [Numbers])?
Perhaps. I've certainly only used them to represent 3D rotations. Are
there any other use cases from commons-numbers?
Not within [Numbers], but that's the point of those very low-level
components/modules: they are common utilities used by higher-level
components/libraries/applications.
Given that "QuaternionRotation" is a special case of "Quaternion",
it is logical to keep the latter at a lower-level, namely in
[Numebers], and make [Geometry] depend on it.
Post by Matt Juntunen
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The conversion to rotation matrix and slerp are the best candidates
here. The other methods rely on core classes from commons-geometry,
namely Vector3D.
Is "slerp" applicable to a general "Quaternion", or does it assume
the additional requirements of "QuaternionRotation"?
[Same question applies to all utilities in order to decide where to
define them.]
Post by Matt Juntunen
One more note: I decided to make a separate package for 3D rotations
in my working branch for GEOMETRY-14, so QuaternionRotation is now at
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java.
Could you please update it so that it inherits from "Quaternion"?
Thanks,
Gilles
Post by Matt Juntunen
-Matt
________________________________
Sent: Sunday, December 2, 2018 3:57 PM
Making Quaternion a VALJO)
Post by Matt Juntunen
Unless anyone objects, I'm going to continue with what I'm working on
I certainly don't object on your working to improve the geometry
code, but wherever that work overlaps with code being worked on
elsewhere (in this case, the "Quaternion" class), then we'd
rather have a discussion happening here first.
Post by Matt Juntunen
with QuaternionRotation and create a merge request. That way, we'll
at
least have a reference implementation and baseline functionality for
commons-geometry that we can modify later based on what's decided
here.
My questions below are a start; I'm waiting for answers.
Code duplication is bad (TM).
Regards,
Gilles
Post by Matt Juntunen
-Matt
________________________________
Sent: Saturday, December 1, 2018 9:40 PM
Making Quaternion a VALJO)
Post by Gilles
Hello.
Post by Matt Juntunen
Hi guys,
FYI, I've been working on a quaternion-related class named
QuaternionRotation for commons-geometry (see link below). It
includes
slerp as well as several other geometry-oriented methods, such as
conversion to/from axis-angle representations and creation from
basis
rotations. It's not quite ready for a merge yet since I still need
to
finish the Euler angle conversions.
I did not use the Quaternion class from commons-numbers since I
wanted to focus solely on using quaternions to represent 3D
rotations.
I felt like the commons-numbers class was too general for this.
We need to explore further how to avoid duplication.
* Should "QuaternionRotation" inherit from "Quaternion"?
* Should "Quaternion" be defined in [Geometry] (and removed from [Numbers])?
* Are some utilities defined in "QuaternionRotation" general
such that they could be part of the [Numbers] "Quaternion" API.
An example might be the transformation between quaternion and
matrix (represented as a double[3][3])?
The second consideration could apply to any computation that does
not require types defined in [Geometry]. For example,
interpolation
is a purely quaternion-internal operation.
s/second/third/
Post by Gilles
It looks to me that it should be possible to come up with a design
that defines "rotation" in [Geometry] which uses a "quaternion"
defined in [Numbers].
Otherwise, one would wonder why "Complex" is also not in
[Geometry]
(for 2D rotations).
Best regards,
Gilles
Post by Matt Juntunen
Regards,
Matt
https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java
[https://avatars1.githubusercontent.com/u/3809623?s=400&v=4]<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
darkma773r/commons-geometry<https://github.com/darkma773r/commons-geometry/blob/transforms/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/QuaternionRotation.java>
Apache Commons Geometry. Contribute to
darkma773r/commons-geometry
development by creating an account on GitHub.
github.com
________________________________
Sent: Friday, November 30, 2018 9:37 AM
Subject: Re: [numbers] Making Quaternion a VALJO
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
and I have also emailed an ICLA.
Not received/acknowledged yet.
I am now listed on the "Persons with signed CLAs but who are not
(yet)
committers." page.
Welcome!
Post by Steve Bosman
Post by Gilles
Post by Steve Bosman
I think two convenience divide methods performing qr^{-1} and
r^{-1}q
Post by Steve Bosman
for q
and r would be useful, but I couldn't think of nice names for
them.
What are the use-cases?
Why aren't "multiply" and "inverse" enough?
I must admit I'm new to quaternions and stumbled into the
project
while
trying to improve my understanding so I'm not going to claim great
knowledge of how common these operations are. I was primarily
thinking of
Quaternion Interpolation - SLERP and SQUAD. It seems to me that you
end up
creating inverse instances and throwing them away a lot and I thought
it
would be good to reduce that overhead.
Surely, the class "Quaternion" is minimal but, before adding to
the API, we be careful to have use-cases for low-level
operations.
Those mentioned above seems more high-level, tied to a specific
domain (see also "Commons Geometry", another new component not yet
released) but I may be wrong...
Regards,
Gilles
Post by Steve Bosman
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org

Loading...