Wolfgang Glas a écrit :
> Gilles Sadowski schrieb:
>> Hi.
>>
>>> There is a very good article on ieee754 equality under
>>>
>>> http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
>>>
>>> which contains an excessive discussion about various "equality" approaches.
>>>
>>> I
Gilles Sadowski schrieb:
> Hi.
>
>> There is a very good article on ieee754 equality under
>>
>> http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
>>
>> which contains an excessive discussion about various "equality" approaches.
>>
>> IMHO it should be moreover considere
Hi.
> There is a very good article on ieee754 equality under
>
> http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
>
> which contains an excessive discussion about various "equality" approaches.
>
> IMHO it should be moreover considered to include the
> "AlomostEqual
Gilles Sadowski schrieb:
>>> L1 norm: equals(a, b, tolerance) = sum(abs(a-b)) < tolerance
>>> L2 norm: equals(a, b, tolerance) = sqrt(sum((a-b)^2)) < tolerance
>>> L-infinity norm: equals(a, b, tolerance) = max(abs(a-b)) < tolerance
>>>
>>> All are useful.
>> I'll guess for 3D vector the L2-norm is
Absolutely.
On Tue, Apr 28, 2009 at 2:10 PM, Gilles Sadowski <
gil...@harfang.homelinux.org> wrote:
> > I'll guess for 3D vector the L2-norm is the more useful as it is
> > invariant when physical orthonormal frames are changed.
> > I'll check in the variant you prefer.
>
> [Cf. my other reply.]
> > L1 norm: equals(a, b, tolerance) = sum(abs(a-b)) < tolerance
> > L2 norm: equals(a, b, tolerance) = sqrt(sum((a-b)^2)) < tolerance
> > L-infinity norm: equals(a, b, tolerance) = max(abs(a-b)) < tolerance
> >
> > All are useful.
>
> I'll guess for 3D vector the L2-norm is the more useful as it
How about:
Vector3D {
...
enum Norm { L_0, L_1, L_2, L_infinity};
static double distance(Vector3D a, Vector3D b, Norm n);
...
}
?
You can then use distance(a, b, Vector3D.Norm.L_infinity) < epsilon
It gives you what you want and it should be very recognizable to the reader
o
> Among the definitions that are commonly used, you will find:
>
> L1 norm: equals(a, b, tolerance) = sum(abs(a-b)) < tolerance
> L2 norm: equals(a, b, tolerance) = sqrt(sum((a-b)^2)) < tolerance
> L-infinity norm: equals(a, b, tolerance) = max(abs(a-b)) < tolerance
That sounds very reasonable, but I wasn't the person with the need.
Also, for equality checking, especially in 3D, all of these will be very,
very close to the same. For very high numbers of dimensions, the
differences between boxes and balls becomes fairly extreme. In particular,
the corners of
Ted Dunning a écrit :
> This is a generally useful thing to have, but there are multiple definitions
> for how you apply the tolerance. You should file a JIRA and add a patch!
>
> Among the definitions that are commonly used, you will find:
>
> L1 norm: equals(a, b, tolerance) = sum(abs(a-b)) <
This is a generally useful thing to have, but there are multiple definitions
for how you apply the tolerance. You should file a JIRA and add a patch!
Among the definitions that are commonly used, you will find:
L1 norm: equals(a, b, tolerance) = sum(abs(a-b)) < tolerance
L2 norm: equals(a, b, to
Hello.
Could we have a
boolean equals(Vector3D other,
double tolerance)
method?
Or even
static boolean equals(Vector3D v1,
Vector3D v2,
double tolerance)
that would return true if the components are equal within the given
toler
12 matches
Mail list logo