You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Patrik Karlström <pa...@trixon.se> on 2021/07/13 13:09:15 UTC

[geometry] From math3.geometry to geometry

I'm in the process of replacing usage of math3.geometry with geometry beta1
and I'm stuck at two places.

My project has pretty limited usage of geometry, only Line, Lines, Segment
and Vector2D from org.apache.commons.geometry.euclidian.twod.

1. How should I replace the call to math3...Segment.distance(Vector2D p)?
https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Segment.html#distance(org.apache.commons.math3.geometry.euclidean.twod.Vector2D)

2. I used to create lines with new Line(...) but now I guess one should use
the methods in Lines. But what about "DoublePrecisionContext", how should I
create and use that?
Looking at the latest commits, DoublePrecisionContext is now replaced, but
until beta2 I'm still on DoublePrecisionContext.

Happy for some guidance here.

/Patrik

Re: [geometry] From math3.geometry to geometry

Posted by Patrik Karlström <pa...@trixon.se>.
Thank you Gilles and Matt, for your answers and for your work.

I have now switched over to Commons Geometry for the calculation of
transversal and longitudinal displacement.
Next up is some 3d collision detection.

/Patrik

Den tis 13 juli 2021 kl 16:30 skrev Matt Juntunen <matt.a.juntunen@gmail.com
>:

> Hello Patrik,
>
> Thanks for your email! Gilles is correct in that Commons Geometry v1.0 will
> be released soon. I plan on starting the release process after the 1.0
> Commons Numbers release is out, which will most likely be some time this
> weekend. So, I suggest coding against the snapshot versions of numbers and
> geometry if you're able to. The only difference between the current
> 1.0-SNAPSHOT version of geometry and the version planned for release is
> that the commons-geometry-hull and commons-geometry-enclosing modules will
> not be included in the release. The APIs for those are not quite ready yet.
>
> In regard to your API questions...
>
> 1. There is no direct replacement for that method in the current API.
> However, you can get the same result with
> "segment.closest(pt).distance(pt)".
>
> 2. Yes, all lines and convex subsets thereof are created through the Lines
> factory class. As for Precision.DoubleEquivalence instances, it is
> recommended to create a single instance for use throughout a computation.
> Instances are immutable and thread-safe so there should be no issues there.
> If you use multiple instances with different epsilon values, you may end up
> with some surprising results due to values being considered equivalent in
> one part of the computation but different in others. If you have a
> pre-defined epsilon value for your domain, you could even create a global
> instance for use throughout the entire application.
>
> Feel free to write back with more questions or open up JIRA issues if you
> find anything lacking.
>
> Regards,
> Matt J
>
> On Tue, Jul 13, 2021 at 9:30 AM Gilles Sadowski <gi...@gmail.com>
> wrote:
>
> > Hi.
> >
> > Le mar. 13 juil. 2021 à 15:10, Patrik Karlström <pa...@trixon.se> a
> > écrit :
> > >
> > > I'm in the process of replacing usage of math3.geometry with geometry
> > beta1
> > > and I'm stuck at two places.
> > >
> > > My project has pretty limited usage of geometry, only Line, Lines,
> > Segment
> > > and Vector2D from org.apache.commons.geometry.euclidian.twod.
> > >
> > > 1. How should I replace the call to math3...Segment.distance(Vector2D
> p)?
> > >
> >
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Segment.html#distance(org.apache.commons.math3.geometry.euclidean.twod.Vector2D)
> > >
> > > 2. I used to create lines with new Line(...) but now I guess one should
> > use
> > > the methods in Lines. But what about "DoublePrecisionContext", how
> > should I
> > > create and use that?
> > > Looking at the latest commits, DoublePrecisionContext is now replaced,
> > but
> > > until beta2 I'm still on DoublePrecisionContext.
> >
> > There won't be a "beta2"; "Commons Numbers" v1.0 (that defines interface
> > "Precision.DoubleEquivalence" as replacement for
> "DoublePrecisionContext")
> > will be released in a few days.  The release process of "Commons
> Geometry"
> > v1.0 will probably start shortly afterwards.
> >
> > >
> > > Happy for some guidance here.
> >
> > I suggest that you test the current snapshot[1] as the official release
> > should
> > be very similar.  It is important to know that your use-case is indeed
> > covered.
> >
> > Thanks,
> > Gilles
> >
> > [1]
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-geometry-euclidean/1.0-SNAPSHOT/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
> >
>

Re: [geometry] From math3.geometry to geometry

Posted by Matt Juntunen <ma...@gmail.com>.
Hello Patrik,

Thanks for your email! Gilles is correct in that Commons Geometry v1.0 will
be released soon. I plan on starting the release process after the 1.0
Commons Numbers release is out, which will most likely be some time this
weekend. So, I suggest coding against the snapshot versions of numbers and
geometry if you're able to. The only difference between the current
1.0-SNAPSHOT version of geometry and the version planned for release is
that the commons-geometry-hull and commons-geometry-enclosing modules will
not be included in the release. The APIs for those are not quite ready yet.

In regard to your API questions...

1. There is no direct replacement for that method in the current API.
However, you can get the same result with
"segment.closest(pt).distance(pt)".

2. Yes, all lines and convex subsets thereof are created through the Lines
factory class. As for Precision.DoubleEquivalence instances, it is
recommended to create a single instance for use throughout a computation.
Instances are immutable and thread-safe so there should be no issues there.
If you use multiple instances with different epsilon values, you may end up
with some surprising results due to values being considered equivalent in
one part of the computation but different in others. If you have a
pre-defined epsilon value for your domain, you could even create a global
instance for use throughout the entire application.

Feel free to write back with more questions or open up JIRA issues if you
find anything lacking.

Regards,
Matt J

On Tue, Jul 13, 2021 at 9:30 AM Gilles Sadowski <gi...@gmail.com>
wrote:

> Hi.
>
> Le mar. 13 juil. 2021 à 15:10, Patrik Karlström <pa...@trixon.se> a
> écrit :
> >
> > I'm in the process of replacing usage of math3.geometry with geometry
> beta1
> > and I'm stuck at two places.
> >
> > My project has pretty limited usage of geometry, only Line, Lines,
> Segment
> > and Vector2D from org.apache.commons.geometry.euclidian.twod.
> >
> > 1. How should I replace the call to math3...Segment.distance(Vector2D p)?
> >
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Segment.html#distance(org.apache.commons.math3.geometry.euclidean.twod.Vector2D)
> >
> > 2. I used to create lines with new Line(...) but now I guess one should
> use
> > the methods in Lines. But what about "DoublePrecisionContext", how
> should I
> > create and use that?
> > Looking at the latest commits, DoublePrecisionContext is now replaced,
> but
> > until beta2 I'm still on DoublePrecisionContext.
>
> There won't be a "beta2"; "Commons Numbers" v1.0 (that defines interface
> "Precision.DoubleEquivalence" as replacement for "DoublePrecisionContext")
> will be released in a few days.  The release process of "Commons Geometry"
> v1.0 will probably start shortly afterwards.
>
> >
> > Happy for some guidance here.
>
> I suggest that you test the current snapshot[1] as the official release
> should
> be very similar.  It is important to know that your use-case is indeed
> covered.
>
> Thanks,
> Gilles
>
> [1]
> https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-geometry-euclidean/1.0-SNAPSHOT/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: [geometry] From math3.geometry to geometry

Posted by Gilles Sadowski <gi...@gmail.com>.
Hi.

Le mar. 13 juil. 2021 à 15:10, Patrik Karlström <pa...@trixon.se> a écrit :
>
> I'm in the process of replacing usage of math3.geometry with geometry beta1
> and I'm stuck at two places.
>
> My project has pretty limited usage of geometry, only Line, Lines, Segment
> and Vector2D from org.apache.commons.geometry.euclidian.twod.
>
> 1. How should I replace the call to math3...Segment.distance(Vector2D p)?
> https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/org/apache/commons/math3/geometry/euclidean/twod/Segment.html#distance(org.apache.commons.math3.geometry.euclidean.twod.Vector2D)
>
> 2. I used to create lines with new Line(...) but now I guess one should use
> the methods in Lines. But what about "DoublePrecisionContext", how should I
> create and use that?
> Looking at the latest commits, DoublePrecisionContext is now replaced, but
> until beta2 I'm still on DoublePrecisionContext.

There won't be a "beta2"; "Commons Numbers" v1.0 (that defines interface
"Precision.DoubleEquivalence" as replacement for "DoublePrecisionContext")
will be released in a few days.  The release process of "Commons Geometry"
v1.0 will probably start shortly afterwards.

>
> Happy for some guidance here.

I suggest that you test the current snapshot[1] as the official release should
be very similar.  It is important to know that your use-case is indeed covered.

Thanks,
Gilles

[1] https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-geometry-euclidean/1.0-SNAPSHOT/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org