Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 1963

How to use vector calculation in RAS Studio 10.2

$
0
0

Hi

I am trying to make this basic example code running and I couldn't succeed. I says on the console:

1st line: 0.00 0.00

2nd line: 0.00

and this doesn't comply with the expected results as said in the code itself.

any advice on how to proceed?

Many thanks in advance.

PS: I had to add the line "System.Math.Vectors", otherwise the code wont compile (or compile with mistakes).

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  System.Types,
  System.Math.Vectors;

var
  aVector: TVector;
  aPoint: TPointF;
  aLength: Single;

begin
  aPoint.Create(2,3);
  aVector.Create(aPoint);
  writeln(Format('%2.2f %2.2f',[aVector.X,aVector.Y]));
  // The console will output: 2.00 3.00, representing the coordinates for aVector.

  aLength:=aVector.Length;
  writeln(Format('%2.2f',[aLength]));
  // The console will output: 3.61, representing the length of a aVector.

  Readln;
end.

 


Viewing all articles
Browse latest Browse all 1963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>