Apparently there's already functions for all this stuff...
Printable View
Apparently there's already functions for all this stuff...
This looks more like the midpoint formula than the distance formula...
how does 0, 0 and 5, 5, result a mid point of (2, 2)?
:blink:
haahhaha
SCAR Code:program Midpoint;
var
x1, y1, x2, y2: Extended;
procedure Points;
begin
x1 := 0;
y1 := 0;
x2 := 5;
y2 := 5;
end;
procedure MidPoint;
var
x, y: Extended;
begin
x := (x2 + x1) div 2;
y := (y2 + y1) div 2;
WriteLn('The Midpoint between (' + FloatToStr(x1) + ', ' + FloatToStr(y1) + ') and (' +
FloatToStr(x2) + ', ' + FloatToStr(y2) + ') is (' +
FloatToStr(x) + ', ' + FloatToStr(y) + ')!');
end;
begin
Points;
MidPoint;
end.
Code:Successfully compiled (7 ms)
The Midpoint between (0, 0) and (5, 5) is (2.5, 2.5)!
Successfully executed
Distance:
Midpoint:SCAR Code:Distance(x1, y1, x2, y2);
SCAR Code:MiddleTPA([Point(x1, y1), Point(x2, y2)]);
Isn't MiddleTPA abstract though? It's customized to find the center of a blob or something?
Well in this case it's clearly wrongly defined behaviour though, thus you can see it in a funny way.
Oh well, trial 'n error is your best teacher.