Skip to content

Commit c7fc871

Browse files
ADD: Update Libs
1 parent 5cd2af1 commit c7fc871

File tree

11 files changed

+355
-72
lines changed

11 files changed

+355
-72
lines changed

miniprojects/2048/uvectormath.pas

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* uvectormat.pas 12.11.2014 *)
33
(* *)
4-
(* Version : 0.17 *)
4+
(* Version : 0.18 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -59,6 +59,7 @@
5959
(* TMatrix4x4.Raw, TMatrix4x4.getInverse, *)
6060
(* TMatrix3x3.getInverse, TMatrix2x2.getInverse *)
6161
(* InvertMatrix2 for TMatrix4x4, TMatrix2x2 *)
62+
(* 0.18 *)
6263
(* *)
6364
(******************************************************************************)
6465
Unit uvectormath;
@@ -544,6 +545,11 @@
544545
// True, wenn sich die Geradenstücke AB und CD Schneigen, Wenn True ist P der Schnittpunkt
545546
Function IntersectLine_segments(Const A, B, C, D: TVector2; Out P: TVector2): Boolean;
546547

548+
//
549+
// Gibt die Projektion des Punkts P auf den Lotfußpunkt der Geraden durch P1 und P2 zurück
550+
//
551+
Function CalculatePlumbFootPoint(Const P, P1, P2: TVector2): TVector2;
552+
547553
// Berechnet die Schnittpunkte einer Ellipse mit einem Streckenabschnitt AB
548554
// Die Ellipse ist definiert durch M und hat die Ausdehnung Rx, Ry
549555
// In P1 bzw. P2 sind die sich ergebenden Schnittpunkte hinterlegt
@@ -3072,20 +3078,45 @@
30723078
a01 := m_a.y;
30733079
a10 := -(m_B.x);
30743080
a11 := -(m_B.y);
3075-
a20 := b.x - a.x;
3076-
a21 := b.y - a.y;
30773081
det := a00 * a11 - a01 * a10;
30783082
If det <> 0 Then Begin
3079-
result := true;
3083+
a20 := b.x - a.x;
3084+
a21 := b.y - a.y;
30803085
dett := a20 * a11 - a21 * a10;
30813086
r := dett / det;
30823087
p := a + r * m_A;
3088+
result := true;
30833089
End
30843090
Else Begin
30853091
result := false;
30863092
End;
30873093
End;
30883094

3095+
Function CalculatePlumbFootPoint(Const P, P1, P2: TVector2): TVector2;
3096+
(*
3097+
* In 2D kann man tatsächlich die Gleichung einfach aufstellen und direkt
3098+
* auflösen.
3099+
*
3100+
* Die Idee:
3101+
* - P3 = beweglicher Punkt auf der Geraden P1 - P2
3102+
* - Der Vektor P - P3 muss im Rechten Winkel zum Richtungsvektor der Geraden stehen
3103+
* => Das Scalarprodukt dieser beiden ist also 0
3104+
*)
3105+
Var
3106+
p3: TVector2;
3107+
s, nominator: Single;
3108+
Begin
3109+
// Nebenbedingung
3110+
p3 := p2 - p1;
3111+
nominator := LenV2SQR(p3);
3112+
If nominator = 0 Then Begin
3113+
Raise exception.create('uvectormath.CalculatePlumbFootPoint: p1 = p2');
3114+
exit;
3115+
End;
3116+
s := (-p3.x * (p2.x - p.x) - p3.y * (p2.y - p.y)) / nominator;
3117+
result := p3 * s + p2;
3118+
End;
3119+
30893120
Function IntersectLineEllipse(Const A, B, M: TVector2; Rx, Ry: TBaseType; Out
30903121
P1, P2: TVector2): integer;
30913122
Var

miniprojects/Image_Multiplication/uvectormath.pas

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* uvectormat.pas 12.11.2014 *)
33
(* *)
4-
(* Version : 0.17 *)
4+
(* Version : 0.18 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -59,6 +59,7 @@
5959
(* TMatrix4x4.Raw, TMatrix4x4.getInverse, *)
6060
(* TMatrix3x3.getInverse, TMatrix2x2.getInverse *)
6161
(* InvertMatrix2 for TMatrix4x4, TMatrix2x2 *)
62+
(* 0.18 *)
6263
(* *)
6364
(******************************************************************************)
6465
Unit uvectormath;
@@ -544,6 +545,11 @@
544545
// True, wenn sich die Geradenstücke AB und CD Schneigen, Wenn True ist P der Schnittpunkt
545546
Function IntersectLine_segments(Const A, B, C, D: TVector2; Out P: TVector2): Boolean;
546547

548+
//
549+
// Gibt die Projektion des Punkts P auf den Lotfußpunkt der Geraden durch P1 und P2 zurück
550+
//
551+
Function CalculatePlumbFootPoint(Const P, P1, P2: TVector2): TVector2;
552+
547553
// Berechnet die Schnittpunkte einer Ellipse mit einem Streckenabschnitt AB
548554
// Die Ellipse ist definiert durch M und hat die Ausdehnung Rx, Ry
549555
// In P1 bzw. P2 sind die sich ergebenden Schnittpunkte hinterlegt
@@ -3072,20 +3078,45 @@
30723078
a01 := m_a.y;
30733079
a10 := -(m_B.x);
30743080
a11 := -(m_B.y);
3075-
a20 := b.x - a.x;
3076-
a21 := b.y - a.y;
30773081
det := a00 * a11 - a01 * a10;
30783082
If det <> 0 Then Begin
3079-
result := true;
3083+
a20 := b.x - a.x;
3084+
a21 := b.y - a.y;
30803085
dett := a20 * a11 - a21 * a10;
30813086
r := dett / det;
30823087
p := a + r * m_A;
3088+
result := true;
30833089
End
30843090
Else Begin
30853091
result := false;
30863092
End;
30873093
End;
30883094

3095+
Function CalculatePlumbFootPoint(Const P, P1, P2: TVector2): TVector2;
3096+
(*
3097+
* In 2D kann man tatsächlich die Gleichung einfach aufstellen und direkt
3098+
* auflösen.
3099+
*
3100+
* Die Idee:
3101+
* - P3 = beweglicher Punkt auf der Geraden P1 - P2
3102+
* - Der Vektor P - P3 muss im Rechten Winkel zum Richtungsvektor der Geraden stehen
3103+
* => Das Scalarprodukt dieser beiden ist also 0
3104+
*)
3105+
Var
3106+
p3: TVector2;
3107+
s, nominator: Single;
3108+
Begin
3109+
// Nebenbedingung
3110+
p3 := p2 - p1;
3111+
nominator := LenV2SQR(p3);
3112+
If nominator = 0 Then Begin
3113+
Raise exception.create('uvectormath.CalculatePlumbFootPoint: p1 = p2');
3114+
exit;
3115+
End;
3116+
s := (-p3.x * (p2.x - p.x) - p3.y * (p2.y - p.y)) / nominator;
3117+
result := p3 * s + p2;
3118+
End;
3119+
30893120
Function IntersectLineEllipse(Const A, B, M: TVector2; Rx, Ry: TBaseType; Out
30903121
P1, P2: TVector2): integer;
30913122
Var

miniprojects/Imageinspector/uvectormath.pas

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* uvectormat.pas 12.11.2014 *)
33
(* *)
4-
(* Version : 0.17 *)
4+
(* Version : 0.18 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -59,6 +59,7 @@
5959
(* TMatrix4x4.Raw, TMatrix4x4.getInverse, *)
6060
(* TMatrix3x3.getInverse, TMatrix2x2.getInverse *)
6161
(* InvertMatrix2 for TMatrix4x4, TMatrix2x2 *)
62+
(* 0.18 *)
6263
(* *)
6364
(******************************************************************************)
6465
Unit uvectormath;
@@ -544,6 +545,11 @@
544545
// True, wenn sich die Geradenstücke AB und CD Schneigen, Wenn True ist P der Schnittpunkt
545546
Function IntersectLine_segments(Const A, B, C, D: TVector2; Out P: TVector2): Boolean;
546547

548+
//
549+
// Gibt die Projektion des Punkts P auf den Lotfußpunkt der Geraden durch P1 und P2 zurück
550+
//
551+
Function CalculatePlumbFootPoint(Const P, P1, P2: TVector2): TVector2;
552+
547553
// Berechnet die Schnittpunkte einer Ellipse mit einem Streckenabschnitt AB
548554
// Die Ellipse ist definiert durch M und hat die Ausdehnung Rx, Ry
549555
// In P1 bzw. P2 sind die sich ergebenden Schnittpunkte hinterlegt
@@ -3072,20 +3078,45 @@
30723078
a01 := m_a.y;
30733079
a10 := -(m_B.x);
30743080
a11 := -(m_B.y);
3075-
a20 := b.x - a.x;
3076-
a21 := b.y - a.y;
30773081
det := a00 * a11 - a01 * a10;
30783082
If det <> 0 Then Begin
3079-
result := true;
3083+
a20 := b.x - a.x;
3084+
a21 := b.y - a.y;
30803085
dett := a20 * a11 - a21 * a10;
30813086
r := dett / det;
30823087
p := a + r * m_A;
3088+
result := true;
30833089
End
30843090
Else Begin
30853091
result := false;
30863092
End;
30873093
End;
30883094

3095+
Function CalculatePlumbFootPoint(Const P, P1, P2: TVector2): TVector2;
3096+
(*
3097+
* In 2D kann man tatsächlich die Gleichung einfach aufstellen und direkt
3098+
* auflösen.
3099+
*
3100+
* Die Idee:
3101+
* - P3 = beweglicher Punkt auf der Geraden P1 - P2
3102+
* - Der Vektor P - P3 muss im Rechten Winkel zum Richtungsvektor der Geraden stehen
3103+
* => Das Scalarprodukt dieser beiden ist also 0
3104+
*)
3105+
Var
3106+
p3: TVector2;
3107+
s, nominator: Single;
3108+
Begin
3109+
// Nebenbedingung
3110+
p3 := p2 - p1;
3111+
nominator := LenV2SQR(p3);
3112+
If nominator = 0 Then Begin
3113+
Raise exception.create('uvectormath.CalculatePlumbFootPoint: p1 = p2');
3114+
exit;
3115+
End;
3116+
s := (-p3.x * (p2.x - p.x) - p3.y * (p2.y - p.y)) / nominator;
3117+
result := p3 * s + p2;
3118+
End;
3119+
30893120
Function IntersectLineEllipse(Const A, B, M: TVector2; Rx, Ry: TBaseType; Out
30903121
P1, P2: TVector2): integer;
30913122
Var

miniprojects/Imageshop/uopengl_graphikengine.pas

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@
675675
If FileExists(Filename) Then Begin
676676
Data := LowerCase(Filename);
677677
// Graphik bereits geladen
678-
For i := 0 To high(Fimages) Do
678+
For i := 0 To high(Fimages) Do Begin
679679
If Fimages[i].Name = Data Then Begin
680680
result := Fimages[i];
681681
{$IFDEF DEBUGGOUTPUT}
@@ -685,9 +685,9 @@
685685
{$ENDIF}
686686
exit;
687687
End;
688+
End;
688689
// Graphik mus geladen werden
689690
b := TBitmap.create;
690-
//{$IFNDEF FPC}
691691
If lowercase(ExtractFileExt(Filename)) = '.jpg' Then Begin
692692
jp := TJPEGImage.create;
693693
jp.LoadFromFile(Filename);
@@ -701,20 +701,9 @@
701701
png.free;
702702
End
703703
Else Begin
704-
//{$ELSE}
705-
// If lowercase(ExtractFileExt(Filename)) = '.jpg' Then Begin
706-
// jp := TJPEGImage.create;
707-
// jp.LoadFromFile(Filename);
708-
// b.assign(jp);
709-
// jp.free;
710-
// end;
711-
//{$ENDIF}
712704
b.LoadFromFile(Filename);
713-
//{$IFNDEF FPC}
714705
End;
715-
//{$ENDIF}
716706

717-
// b.PixelFormat := pf24bit;
718707
// create the raw image
719708
IntfImg1 := TLazIntfImage.Create(0, 0);
720709
nw := b.width;
@@ -736,7 +725,6 @@
736725
b2.PixelFormat := pf24bit;
737726
b2.width := nw;
738727
b2.height := nh;
739-
// b2.canvas.StretchDraw(rect(0, 0, nw, nh), b);
740728
If Stretch = smStretch Then Begin
741729
Stretchdraw(b2.canvas, rect(0, 0, nw, nh), b, imBilinear);
742730
End
@@ -1327,7 +1315,7 @@
13271315
If FileExists(Filename) Then Begin
13281316
Data := LowerCase(Filename);
13291317
// Graphik bereits geladen
1330-
For i := 0 To high(Fimages) Do
1318+
For i := 0 To high(Fimages) Do Begin
13311319
If Fimages[i].Name = Data Then Begin
13321320
result := Fimages[i];
13331321
{$IFDEF DEBUGGOUTPUT}
@@ -1337,6 +1325,7 @@
13371325
{$ENDIF}
13381326
exit;
13391327
End;
1328+
End;
13401329
// Graphik mus geladen werden
13411330
b := TBitmap.create;
13421331
If lowercase(ExtractFileExt(Filename)) = '.jpg' Then Begin
@@ -1354,20 +1343,10 @@
13541343
png.free;
13551344
End
13561345
Else Begin
1357-
//{$ELSE}
1358-
// If lowercase(ExtractFileExt(Filename)) = '.jpg' Then Begin
1359-
// jp := TJPEGImage.create;
1360-
// jp.LoadFromFile(Filename);
1361-
// b.assign(jp);
1362-
// jp.free;
1363-
// end;
1364-
//{$ENDIF}
13651346
b.LoadFromFile(Filename);
1366-
//{$IFNDEF FPC}
13671347
End;
13681348
// create the raw image
13691349
IntfImg1 := TLazIntfImage.Create(0, 0);
1370-
// b.PixelFormat := pf24bit;
13711350
nw := b.width;
13721351
nh := b.height;
13731352
ow := b.width;
@@ -1586,9 +1565,7 @@
15861565
writeln('OpenGL Buffer : ' + FileSizetoString(OpenGLBufCount));
15871566
{$ENDIF}
15881567
If IsPowerOfTwo(g.width) And IsPowerOfTwo(g.Height) Then Begin
1589-
// g.pixelformat := pf24bit;
1590-
// a.pixelformat := pf24bit;
1591-
// create the raw image
1568+
// create the raw image
15921569
Graphik_intf := TLazIntfImage.Create(0, 0);
15931570
Alpha_intf := TLazIntfImage.Create(0, 0);
15941571

@@ -1704,7 +1681,6 @@
17041681
Else Begin
17051682
b.LoadFromFile(Graphik);
17061683
End;
1707-
// b.PixelFormat := pf24bit;
17081684
If lowercase(ExtractFileExt(AlphaMask)) = '.jpg' Then Begin
17091685
jp := TJPEGImage.create;
17101686
jp.LoadFromFile(AlphaMask);
@@ -1720,7 +1696,6 @@
17201696
Else Begin
17211697
a.LoadFromFile(AlphaMask);
17221698
End;
1723-
// a.PixelFormat := pf24bit;
17241699
// create the raw image
17251700
IntfImg1 := TLazIntfImage.Create(0, 0);
17261701
IntfImg2 := TLazIntfImage.Create(0, 0);
@@ -1743,7 +1718,6 @@
17431718
b2.PixelFormat := pf24bit;
17441719
b2.width := nw;
17451720
b2.height := nh;
1746-
// b2.canvas.StretchDraw(rect(0, 0, nw, nh), b);
17471721
If Stretch = smStretch Then Begin
17481722
Stretchdraw(b2.canvas, rect(0, 0, nw, nh), b, imBilinear);
17491723
End
@@ -1902,7 +1876,6 @@
19021876
IntfImg2.CreateBitmaps(ImgHandle, ImgMaskHandle, false);
19031877
a.Handle := ImgHandle;
19041878
a.MaskHandle := ImgMaskHandle;
1905-
//a.SaveToFile(Graphik + 'alpha.bmp');
19061879
IntfImg2.free;
19071880
IntfImg1.free;
19081881
result := LoadAlphaGraphik(b, a, Graphik, Stretch);

0 commit comments

Comments
 (0)