On Wed, 26 Jul 2017, Reimar Grabowski via Lazarus wrote:
On Wed, 26 Jul 2017 18:53:34 +0100
Graeme Geldenhuys via Lazarus wrote:
On 2017-07-26 17:27, Alexey via Lazarus wrote:
> Hm, in my app Int makes sense: i need to compare Points in binary
> search, and
Am 26.07.2017 19:51 schrieb "Graeme Geldenhuys via Lazarus" <
lazarus@lists.lazarus-ide.org>:
>> If "equals" is needed, why not simply use p1=p2 ?
>
>
> If operator overload exists for the types then sure, but as you know I
like OOP approaches to things.
>
> Also is TPoint a record or a object or
First start by defining what ComparePoints is supposed to measure or
compare.
yes, of course: compare source editor x/y positions. Ie, it is
CompareCoords.
--
Regards,
Alexey
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
On 2017-07-26 17:27, Alexey via Lazarus wrote:
Hm, in my app Int makes sense: i need to compare Points in binary
search, and see: >, <, =.
Ever heard of Manhatten Length? That would be a more logical approach.
It is a commonly used length calculation for points.
On 2017-07-26 16:22, Michael Van Canneyt via Lazarus wrote:
First start by defining what ComparePoints is supposed to measure or compare.
If "compare" doesn't mean "equals", then a better name should be used,
otherwise that too is up for incorrect interpretation.
If "equals" is needed,
IMHO you should consider 5 cases: P1 = P2 and the four quadrants
https://en.m.wikipedia.org/wiki/Quadrant_(plane_geometry)
- Quadrant I should correspond to >
- Quadrant III should correspond to <
- What about quadrants II and IV? You could compare your point to Y = -X
line to reduce your study
On Wed, 26 Jul 2017, Alexey via Lazarus wrote:
On 26.07.2017 18:11, Graeme Geldenhuys via Lazarus wrote:
ComparePoints() returning a Integer is not a very friendly return type
either,
Hm, in my app Int makes sense: i need to compare Points in binary
search, and see: >, <, =.
This
On 26.07.2017 18:11, Graeme Geldenhuys via Lazarus wrote:
ComparePoints() returning a Integer is not a very friendly return type
either,
Hm, in my app Int makes sense: i need to compare Points in binary
search, and see: >, <, =.
--
Regards,
Alexey
--
On Wed, 26 Jul 2017, Graeme Geldenhuys via Lazarus wrote:
On 2017-07-26 14:54, Alexey via Lazarus wrote:
I think LCL has many Compare funcs, but misses func for TPoint. Here
it's comparing x/y screen coordinates
Why not extend TPoint with an IsEquals() method, so you can do something
What do you think about:
function ComparePoints(P1, P2: TPoint): TPoint;
begin
Result.X := (P1.X - P2.X);
Result.Y := (P1.Y - P2.Y);
end;
Best regards.
Sandro Cumerlato
On Jul 26, 2017 3:56 PM, "Alexey via Lazarus"
wrote:
I think LCL has many Compare
10 matches
Mail list logo