Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Warp Speed to a Conversion family

Tags:

delphi

I have added a Speed family to the ConvUtils using meters per second as the base.

i.e.

   Cf := RegisterConversionFamily('Speed');
   RegisterConversionType(Cf,'Meters per second'    ,1);
   RegisterConversionType(Cf,'Speed of Light'       ,0.000000003335641);
   RegisterConversionType(Cf,'Speed of Sound(Mach)' ,0.0029411765);

Now I would like to add 'Warp Speed' as a type.

I have the formula

V = wf^3 * C

Where: V = Velocity wf = Warp Factor C = Speed of light

How can I add a formula to add a type?

like image 485
Steve Avatar asked Dec 31 '12 17:12

Steve


1 Answers

You can register own formulas for conversion:

function ToWarp(const AValue: Double): Double;
begin
   Result := YourFormula1;
end;

function FromWarp(const AValue: Double): Double;
begin
   Result := YourFormula2;
end;

RegisterConversionType(Cf,'Warpspeed' ,ToWarp,FromWarp);
like image 171
bummi Avatar answered Oct 14 '22 03:10

bummi