Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,17 +0,0 @@
|
|||
package Apollonius is
|
||||
type Point is record
|
||||
X, Y : Long_Float := 0.0;
|
||||
end record;
|
||||
|
||||
type Circle is record
|
||||
Center : Point;
|
||||
Radius : Long_Float := 0.0;
|
||||
end record;
|
||||
|
||||
type Tangentiality is (External, Internal);
|
||||
|
||||
function Solve_CCC
|
||||
(Circle_1, Circle_2, Circle_3 : Circle;
|
||||
T1, T2, T3 : Tangentiality := External)
|
||||
return Circle;
|
||||
end Apollonius;
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
with Ada.Numerics.Generic_Elementary_Functions;
|
||||
|
||||
package body Apollonius is
|
||||
package Math is new Ada.Numerics.Generic_Elementary_Functions
|
||||
(Long_Float);
|
||||
|
||||
function Solve_CCC
|
||||
(Circle_1, Circle_2, Circle_3 : Circle;
|
||||
T1, T2, T3 : Tangentiality := External)
|
||||
return Circle
|
||||
is
|
||||
S1 : Long_Float := 1.0;
|
||||
S2 : Long_Float := 1.0;
|
||||
S3 : Long_Float := 1.0;
|
||||
|
||||
X1 : Long_Float renames Circle_1.Center.X;
|
||||
Y1 : Long_Float renames Circle_1.Center.Y;
|
||||
R1 : Long_Float renames Circle_1.Radius;
|
||||
|
||||
X2 : Long_Float renames Circle_2.Center.X;
|
||||
Y2 : Long_Float renames Circle_2.Center.Y;
|
||||
R2 : Long_Float renames Circle_2.Radius;
|
||||
|
||||
X3 : Long_Float renames Circle_3.Center.X;
|
||||
Y3 : Long_Float renames Circle_3.Center.Y;
|
||||
R3 : Long_Float renames Circle_3.Radius;
|
||||
begin
|
||||
if T1 = Internal then
|
||||
S1 := -S1;
|
||||
end if;
|
||||
if T2 = Internal then
|
||||
S2 := -S2;
|
||||
end if;
|
||||
if T3 = Internal then
|
||||
S3 := -S3;
|
||||
end if;
|
||||
|
||||
declare
|
||||
V11 : constant Long_Float := 2.0 * X2 - 2.0 * X1;
|
||||
V12 : constant Long_Float := 2.0 * Y2 - 2.0 * Y1;
|
||||
V13 : constant Long_Float :=
|
||||
X1 * X1 - X2 * X2 + Y1 * Y1 - Y2 * Y2 - R1 * R1 + R2 * R2;
|
||||
V14 : constant Long_Float := 2.0 * S2 * R2 - 2.0 * S1 * R1;
|
||||
|
||||
V21 : constant Long_Float := 2.0 * X3 - 2.0 * X2;
|
||||
V22 : constant Long_Float := 2.0 * Y3 - 2.0 * Y2;
|
||||
V23 : constant Long_Float :=
|
||||
X2 * X2 - X3 * X3 + Y2 * Y2 - Y3 * Y3 - R2 * R2 + R3 * R3;
|
||||
V24 : constant Long_Float := 2.0 * S3 * R3 - 2.0 * S2 * R2;
|
||||
|
||||
W12 : constant Long_Float := V12 / V11;
|
||||
W13 : constant Long_Float := V13 / V11;
|
||||
W14 : constant Long_Float := V14 / V11;
|
||||
|
||||
W22 : constant Long_Float := V22 / V21 - W12;
|
||||
W23 : constant Long_Float := V23 / V21 - W13;
|
||||
W24 : constant Long_Float := V24 / V21 - W14;
|
||||
|
||||
P : constant Long_Float := -W23 / W22;
|
||||
Q : constant Long_Float := W24 / W22;
|
||||
M : constant Long_Float := -W12 * P - W13;
|
||||
N : constant Long_Float := W14 - W12 * Q;
|
||||
|
||||
A : constant Long_Float := N * N + Q * Q - 1.0;
|
||||
B : constant Long_Float :=
|
||||
2.0 * M * N -
|
||||
2.0 * N * X1 +
|
||||
2.0 * P * Q -
|
||||
2.0 * Q * Y1 +
|
||||
2.0 * S1 * R1;
|
||||
C : constant Long_Float :=
|
||||
X1 * X1 +
|
||||
M * M -
|
||||
2.0 * M * X1 +
|
||||
P * P +
|
||||
Y1 * Y1 -
|
||||
2.0 * P * Y1 -
|
||||
R1 * R1;
|
||||
|
||||
D : constant Long_Float := B * B - 4.0 * A * C;
|
||||
RS : constant Long_Float := (-B - Math.Sqrt (D)) / (2.0 * A);
|
||||
begin
|
||||
return (Center => (X => M + N * RS, Y => P + Q * RS), Radius => RS);
|
||||
end;
|
||||
end Solve_CCC;
|
||||
end Apollonius;
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
with Apollonius;
|
||||
|
||||
procedure Test_Apollonius is
|
||||
use Apollonius;
|
||||
package Long_Float_IO is new Ada.Text_IO.Float_IO (Long_Float);
|
||||
|
||||
C1 : constant Circle := (Center => (X => 0.0, Y => 0.0), Radius => 1.0);
|
||||
C2 : constant Circle := (Center => (X => 4.0, Y => 0.0), Radius => 1.0);
|
||||
C3 : constant Circle := (Center => (X => 2.0, Y => 4.0), Radius => 2.0);
|
||||
|
||||
R1 : Circle := Solve_CCC (C1, C2, C3, External, External, External);
|
||||
R2 : Circle := Solve_CCC (C1, C2, C3, Internal, Internal, Internal);
|
||||
begin
|
||||
Ada.Text_IO.Put_Line ("R1:");
|
||||
Long_Float_IO.Put (R1.Center.X, Aft => 3, Exp => 0);
|
||||
Long_Float_IO.Put (R1.Center.Y, Aft => 3, Exp => 0);
|
||||
Long_Float_IO.Put (R1.Radius, Aft => 3, Exp => 0);
|
||||
Ada.Text_IO.New_Line;
|
||||
Ada.Text_IO.Put_Line ("R2:");
|
||||
Long_Float_IO.Put (R2.Center.X, Aft => 3, Exp => 0);
|
||||
Long_Float_IO.Put (R2.Center.Y, Aft => 3, Exp => 0);
|
||||
Long_Float_IO.Put (R2.Radius, Aft => 3, Exp => 0);
|
||||
Ada.Text_IO.New_Line;
|
||||
end Test_Apollonius;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
define :circle [x y r][]
|
||||
define :circle [x y r]
|
||||
|
||||
solveApollonius: function [c1 c2 c3 s1 s2 s3][
|
||||
v11: sub 2*c2\x 2*c1\x
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
function Measure-Apollonius
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([PSCustomObject])]
|
||||
Param
|
||||
(
|
||||
[int]$Counter,
|
||||
[double]$x1,
|
||||
[double]$y1,
|
||||
[double]$r1,
|
||||
[double]$x2,
|
||||
[double]$y2,
|
||||
[double]$r2,
|
||||
[double]$x3,
|
||||
[double]$y3,
|
||||
[double]$r3
|
||||
)
|
||||
|
||||
switch ($Counter)
|
||||
{
|
||||
{$_ -eq 2} {$s1 = -1; $s2 = -1; $s3 = -1; break}
|
||||
{$_ -eq 3} {$s1 = 1; $s2 = -1; $s3 = -1; break}
|
||||
{$_ -eq 4} {$s1 = -1; $s2 = 1; $s3 = -1; break}
|
||||
{$_ -eq 5} {$s1 = -1; $s2 = -1; $s3 = 1; break}
|
||||
{$_ -eq 6} {$s1 = 1; $s2 = 1; $s3 = -1; break}
|
||||
{$_ -eq 7} {$s1 = -1; $s2 = 1; $s3 = 1; break}
|
||||
{$_ -eq 8} {$s1 = 1; $s2 = -1; $s3 = 1; break}
|
||||
Default {$s1 = 1; $s2 = 1; $s3 = 1; break}
|
||||
}
|
||||
|
||||
[double]$v11 = 2 * $x2 - 2 * $x1
|
||||
[double]$v12 = 2 * $y2 - 2 * $y1
|
||||
[double]$v13 = $x1 * $x1 - $x2 * $x2 + $y1 * $y1 - $y2 * $y2 - $r1 * $r1 + $r2 * $r2
|
||||
[double]$v14 = 2 * $s2 * $r2 - 2 * $s1 * $r1
|
||||
|
||||
[double]$v21 = 2 * $x3 - 2 * $x2
|
||||
[double]$v22 = 2 * $y3 - 2 * $y2
|
||||
[double]$v23 = $x2 * $x2 - $x3 * $x3 + $y2 * $y2 - $y3 * $y3 - $r2 * $r2 + $r3 * $r3
|
||||
[double]$v24 = 2 * $s3 * $r3 - 2 * $s2 * $r2
|
||||
|
||||
[double]$w12 = $v12 / $v11
|
||||
[double]$w13 = $v13 / $v11
|
||||
[double]$w14 = $v14 / $v11
|
||||
|
||||
[double]$w22 = $v22 / $v21 - $w12
|
||||
[double]$w23 = $v23 / $v21 - $w13
|
||||
[double]$w24 = $v24 / $v21 - $w14
|
||||
|
||||
[double]$P = -$w23 / $w22
|
||||
[double]$Q = $w24 / $w22
|
||||
[double]$M = -$w12 * $P - $w13
|
||||
[double]$N = $w14 - $w12 * $Q
|
||||
|
||||
[double]$a = $N * $N + $Q * $Q - 1
|
||||
[double]$b = 2 * $M * $N - 2 * $N * $x1 + 2 * $P * $Q - 2 * $Q * $y1 + 2 * $s1 * $r1
|
||||
[double]$c = $x1 * $x1 + $M * $M - 2 * $M * $x1 + $P * $P + $y1 * $y1 - 2 * $P * $y1 - $r1 * $r1
|
||||
|
||||
[double]$D = $b * $b - 4 * $a * $c
|
||||
|
||||
[double]$rs = (-$b - [Double]::Parse([Math]::Sqrt($D).ToString())) / (2 * [Double]::Parse($a.ToString()))
|
||||
[double]$xs = $M + $N * $rs
|
||||
[double]$ys = $P + $Q * $rs
|
||||
|
||||
[PSCustomObject]@{
|
||||
X = $xs
|
||||
Y = $ys
|
||||
Radius = $rs
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
for ($i = 1; $i -le 8; $i++)
|
||||
{
|
||||
Measure-Apollonius -Counter $i -x1 0 -y1 0 -r1 1 -x2 4 -y2 0 -r2 1 -x3 2 -y3 4 -r3 2
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue