Seite 2 von 2

Re: Formel für Berechnung gesucht.

Verfasst: 08.04.2021 09:47
von tft
ok ... dann werde ich ein kleines Testprogramm schreiben.

Re: Formel für Berechnung gesucht.

Verfasst: 08.04.2021 20:44
von alter Mann
...musste ober noch was ändern :roll:

Hier die Funktionen für das allgemeine Polyeder:

Code: Alles auswählen

Procedure.i Raumtangentenwinkel (DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,Px.f,Py.f,Pz.f,*E.double)
  Protected Nx.d=DP1x-Px,Ny.d=DP1y-Py,Nz.d=DP1z-Pz,L.d,A2.d,A3.d,V1x.d,V1y.d,V1z.d,V2x.d,V2y.d,V2z.d,Nx1.d,Ny1.d,Nz1.d
  
  L=Nx*Nx+Ny*Ny+Nz*Nz
  
  *E\d = 0.0
  If L = 0.0
    ProcedureReturn 0
  Else
    A2  = (Nx*(DP2x-Px)+Ny*(DP2y-Py)+Nz*(DP2z-Pz))/L
    A3  = (Nx*(DP3x-Px)+Ny*(DP3y-Py)+Nz*(DP3z-Pz))/L
    V1x = DP2x-Nx*A2-Px
    V1y = DP2y-Ny*A2-Py
    V1z = DP2z-Nz*A2-Pz
    V2x = DP3x-Nx*A3-Px
    V2y = DP3y-Ny*A3-Py
    V2z = DP3z-Nz*A3-Pz
    Nx1 = V1y*V2z-V1z*V2y
    Ny1 = V1z*V2x-V1x*V2z
    Nz1 = V1x*V2y-V1y*V2x
    *E\d = ATan2(V1x*V2x+V1y*V2y+V1z*V2z,(Nx1*Nx+Ny1*Ny+Nz1*Nz)/Sqr(L))
  EndIf
  ProcedureReturn 1
EndProcedure

Procedure RaumwinkelVonPunktUndDreieck (DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,Px.f,Py.f,Pz.f,*E.double)
  Protected W1.double,W2.double,W3.double
  
  *E\d = 0.0
  If Raumtangentenwinkel (DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,Px.f,Py.f,Pz.f,@W1) = 0
    ProcedureReturn 0
  EndIf
  If Raumtangentenwinkel (DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,DP1x.f,DP1y.f,DP1z.f,Px.f,Py.f,Pz.f,@W2) = 0
    ProcedureReturn 0
  EndIf
  If Raumtangentenwinkel (DP3x.f,DP3y.f,DP3z.f,DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,Px.f,Py.f,Pz.f,@W3) = 0
    ProcedureReturn 0
  EndIf
  *E\d = W1\d + W2\d + W3\d
  If *E\d > 0
    *E\d - #PI
  Else
    *E\d + #PI
  EndIf
  ProcedureReturn 1
EndProcedure

Procedure PunktInAllgemeinemPolyeder (Anzahl.i, Array Indizes.i(2), Array Punkte.f(2), Px.f, Py.f, Pz.f)
  Protected i.i
  Protected Wd.double,W.double
  
  W\d = 0.0
  
  For i=0 To Anzahl-1
    If RaumwinkelVonPunktUndDreieck (Punkte(Indizes(i,0),0),Punkte(Indizes(i,0),1),Punkte(Indizes(i,0),2),Punkte(Indizes(i,1),0),Punkte(Indizes(i,1),1),Punkte(Indizes(i,1),2),Punkte(Indizes(i,2),0),Punkte(Indizes(i,2),1),Punkte(Indizes(i,2),2),Px,Py,Pz,@Wd) = 0
      ProcedureReturn 0
    EndIf
    W\d + Wd\d
  Next i 
  
  If W\d > 4*#PI-0.0001
    ProcedureReturn 1
  ElseIf W\d < 0.0001
    ProcedureReturn -1
  EndIf
  ProcedureReturn 0
EndProcedure

Re: Formel für Berechnung gesucht.

Verfasst: 09.04.2021 17:20
von tft
Hallo,

nochmal danke für die mühe. Ich hoffe du hast auch deinen Spass. Ich habe das Testprogramm soweit Fertig ...
Allerdings verstehe ich die übergabe der Array nicht.

PunktInAllgemeinemPolyeder (Anzahl.i, Array Indizes.i(2), Array Punkte.f(2), Px.f, Py.f, Pz.f)

ist die Prüffunktion. Anzahl ist die Anzahl. im Indizes ist das Array mit Anzahl Dreiecke mal 3 Elementen.
Und in Punkte sind die Koordinaten abgelegt. Für jeden möglichen Indiz wert x,y,z als Flies Komma.

Ich denke das stimmt soweit. Array Indizes.i(2) ????? ich hätte die Array Global gemacht und mit Shared zugelassen.
Wird damit ein Vollständiges Array übergeben ? Oder nur eine Kopie? So reicht es nur für ein Dreieck oder ?

Gruss TFT

Re: Formel für Berechnung gesucht.

Verfasst: 09.04.2021 17:32
von NicTheQuick
Wenn `Array Indizes.i(2)` in einem Parameter steht, dann bedeutet das nur, dass es zwei Dimension hat, nicht dass es 3 Elemente hat.
Und Arrays, Listen und Maps werden immer als Referenz übergaben, also nicht kopiert.

Re: Formel für Berechnung gesucht.

Verfasst: 09.04.2021 17:45
von tft
tja ... bei mir reklamiert der Compiler ständig ...

Define t.i = PunktInKonvexemPolyeder ( ic, il.PB_MeshFace(), vl.PB_MeshVertex(), EntityX(Pruefpunkt,#PB_Absolute), EntityY(Pruefpunkt,#PB_Absolute), EntityZ(Pruefpunkt,#PB_Absolute))

ich mach das bestimmt total Falsch. Ich versteh auch nicht warum man das so machen sollte? Mit Shared brauche ich das Array nicht übergeben ....

Re: Formel für Berechnung gesucht.

Verfasst: 09.04.2021 18:01
von NicTheQuick
Es wäre besser, wenn alter Mann noch ein oder zwei Beispiel dazu gepackt hätte. Vielleicht macht er das noch. Ich kann dir nur generell sagen, was die Syntax bedeutet. Ich habe seinen Code nicht ausprobiert.

Re: Formel für Berechnung gesucht.

Verfasst: 09.04.2021 18:16
von tft
Na ja ... ich bin ja schon etwas angefixt ... daher habe ich die sache etwas umgestellt ... und es funktioniert ... sowet.

Code: Alles auswählen

Dim vl.PB_MeshVertex(2)
Dim il.PB_MeshFace(2)  

Procedure PunktInAllgemeinemPolyeder (Anzahl,  Px.f, Py.f, Pz.f)
  Protected i.i
  Protected Wd.double,W.double
  Shared il(),vl()
  
  W\d = 0.0
 
  For i=0 To Anzahl-1 Step 3
    If RaumwinkelVonPunktUndDreieck (vl(il(i)\Index)\x,vl(il(i)\Index)\y,vl(il(i)\Index)\z, vl(il(i+1)\Index)\x,vl(il(i+1)\Index)\y,vl(il(i+1)\Index)\z, vl(il(i+2)\Index)\x,vl(il(i+2)\Index)\y,vl(il(i+2)\Index)\z ,Px,Py,Pz,@Wd) = 0
      ProcedureReturn 0
    EndIf
    W\d + Wd\d
  Next i
 
  If W\d > 4*#PI-0.0001
    ProcedureReturn 1
  ElseIf W\d < 0.0001
    ProcedureReturn -1
  EndIf
  ProcedureReturn 0
EndProcedure
Ich werde es den Abend noch etwas ausprobieren.

Gruss TFT

Re: Formel für Berechnung gesucht.

Verfasst: 09.04.2021 22:21
von alter Mann
hier mein Testcode:

Code: Alles auswählen

EnableExplicit

Procedure.i PunktInKonvexemPolyeder ( Anzahl.i, Array Indizes.i(2), Array Punkte.f(2), Px.f, Py.f, Pz.f)
  Protected i.i
  Protected Vx1.d,Vx2.d,Vy1.d,Vy2.d,Vz1.d,Vz2.d,Nx.d,Ny.d,Nz.d,L.d
  
  For i=0 To Anzahl-1
    Vx1 = Punkte(Indizes(i,1),0)-Punkte(Indizes(i,0),0)  ; \
    Vy1 = Punkte(Indizes(i,1),1)-Punkte(Indizes(i,0),1)  ;  Vektor vom 1. Dreieckspunkt zum 2. Dreieckspunkt
    Vz1 = Punkte(Indizes(i,1),2)-Punkte(Indizes(i,0),2)  ; /
    Vx2 = Punkte(Indizes(i,2),0)-Punkte(Indizes(i,0),0)  ; \
    Vy2 = Punkte(Indizes(i,2),1)-Punkte(Indizes(i,0),1)  ;  Vektor vom 1. Dreieckspunkt zum 3. Dreieckspunkt
    Vz2 = Punkte(Indizes(i,2),2)-Punkte(Indizes(i,0),2)  ; /
    Nx = Vy1*Vz2-Vz1*Vy2 ; \
    Ny = Vz1*Vx2-Vx1*Vz2 ;  Normale des Dreiecks
    Nz = Vx1*Vy2-Vy1*Vx2 ; /
    Vx1 = Px-Punkte(Indizes(i,0),0) ; \
    Vy1 = Py-Punkte(Indizes(i,0),1) ;  Vektor vom 1. Dreieckspunkt zum Prüfpunkt
    Vz1 = Pz-Punkte(Indizes(i,0),2) ; /
    L = Vx1*Nx+Vy1*Ny+Vz1*Nz  ; Skalarprodukt
    If L > 0.000001
      ProcedureReturn -1   ; Punkt ausserhalb
    ElseIf L < 0.000001 And L > -0.000001
      ProcedureReturn 0    ; Punkt auf der Hülle
    EndIf
  Next i 
  ProcedureReturn 1 ; Punkt innerhalb
EndProcedure

Procedure.i Raumtangentenwinkel (DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,Px.f,Py.f,Pz.f,*E.double)
  Protected Nx.d=DP1x-Px,Ny.d=DP1y-Py,Nz.d=DP1z-Pz,L.d,A2.d,A3.d,V1x.d,V1y.d,V1z.d,V2x.d,V2y.d,V2z.d,Nx1.d,Ny1.d,Nz1.d
  
  L=Nx*Nx+Ny*Ny+Nz*Nz
  
  *E\d = 0.0
  If L = 0.0
    ProcedureReturn 0
  Else
    A2  = (Nx*(DP2x-Px)+Ny*(DP2y-Py)+Nz*(DP2z-Pz))/L
    A3  = (Nx*(DP3x-Px)+Ny*(DP3y-Py)+Nz*(DP3z-Pz))/L
    V1x = DP2x-Nx*A2-Px
    V1y = DP2y-Ny*A2-Py
    V1z = DP2z-Nz*A2-Pz
    V2x = DP3x-Nx*A3-Px
    V2y = DP3y-Ny*A3-Py
    V2z = DP3z-Nz*A3-Pz
    Nx1 = V1y*V2z-V1z*V2y
    Ny1 = V1z*V2x-V1x*V2z
    Nz1 = V1x*V2y-V1y*V2x
    *E\d = ATan2(V1x*V2x+V1y*V2y+V1z*V2z,(Nx1*Nx+Ny1*Ny+Nz1*Nz)/Sqr(L))
  EndIf
  ProcedureReturn 1
EndProcedure

Procedure RaumwinkelVonPunktUndDreieck (DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,Px.f,Py.f,Pz.f,*E.double)
  Protected W1.double,W2.double,W3.double
  
  *E\d = 0.0
  If Raumtangentenwinkel (DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,Px.f,Py.f,Pz.f,@W1) = 0
    ProcedureReturn 0
  EndIf
  If Raumtangentenwinkel (DP2x.f,DP2y.f,DP2z.f,DP3x.f,DP3y.f,DP3z.f,DP1x.f,DP1y.f,DP1z.f,Px.f,Py.f,Pz.f,@W2) = 0
    ProcedureReturn 0
  EndIf
  If Raumtangentenwinkel (DP3x.f,DP3y.f,DP3z.f,DP1x.f,DP1y.f,DP1z.f,DP2x.f,DP2y.f,DP2z.f,Px.f,Py.f,Pz.f,@W3) = 0
    ProcedureReturn 0
  EndIf
  *E\d = W1\d + W2\d + W3\d
  If *E\d > 0
    *E\d - #PI
  Else
    *E\d + #PI
  EndIf
  
  ProcedureReturn 1
EndProcedure

Procedure PunktInAllgemeinemPolyeder (Anzahl.i, Array Indizes.i(2), Array Punkte.f(2), Px.f, Py.f, Pz.f)
  Protected i.i
  Protected Wd.double,W.double
  
  W\d = 0.0
  
  For i=0 To Anzahl-1
    If RaumwinkelVonPunktUndDreieck (Punkte(Indizes(i,0),0),Punkte(Indizes(i,0),1),Punkte(Indizes(i,0),2),Punkte(Indizes(i,1),0),Punkte(Indizes(i,1),1),Punkte(Indizes(i,1),2),Punkte(Indizes(i,2),0),Punkte(Indizes(i,2),1),Punkte(Indizes(i,2),2),Px,Py,Pz,@Wd) = 0
      ProcedureReturn 0
    EndIf
    W\d + Wd\d
  Next i 
  
  If W\d > 4*#PI-0.0001
    ProcedureReturn 1
  ElseIf W\d < 0.0001
    ProcedureReturn -1
  EndIf
  ProcedureReturn 0
EndProcedure

Global INDICES1.s="0 1 2 -1 3 4 5 -1 6 7 4 -1 6 4 3 -1 8 9 7 -1 8 7 6 -1 10 4 7 -1 10 2 4 -1 10 7 9 -1 11 2 10 -1 11 0 2 -1 11 10 9 -1 12 0 11 -1 12 11 9 -1 13 6 3 -1 13 8 6 -1 14 8 13 -1 14 9 8 -1 15 14 13 -1 15 16 14 -1 17 5 4 -1 17 4 2 -1 18 19 20 -1 18 16 15 -1 21 20 22 -1 21 16 18 -1 21 18 20 -1 23 21 22 -1 23 16 21 -1 24 9 14 -1 24 14 16 -1 25 3 5 -1 25 26 13 -1 25 13 3 -1 27 26 19 -1 27 13 26 -1 27 19 18 -1 27 15 13 -1 28 12 9 -1 28 9 24 -1 29 27 18 -1 29 18 15 -1 29 15 27 -1 30 26 25 -1 30 25 5 -1 31 24 16 -1 31 16 23 -1 32 19 26 -1 32 26 30 -1 33 20 19 -1 33 19 32 -1 34 17 1 -1 35 30 5 -1 35 17 34 -1 36 28 31 -1 37 0 12 -1 37 28 36 -1 38 35 5 -1 38 5 17 -1 38 17 35 -1 39 12 28 -1 39 28 37 -1 39 37 12 -1 40 2 1 -1 40 1 17 -1 40 17 2 -1 41 28 24 -1 41 24 31 -1 41 31 28 -1 42 32 30 -1 42 30 35 -1 43 35 34 -1 43 42 35 -1 44 33 42 -1 44 42 43 -1 45 0 37 -1 45 37 36 -1 46 45 36 -1 47 33 32 -1 47 32 42 -1 47 42 33 -1 48 1 0 -1 48 0 45 -1 48 45 46 -1 49 22 20 -1 49 33 44 -1 50 20 33 -1 50 33 49 -1 50 49 20 -1 51 48 46 -1 52 34 1 -1 52 48 51 -1 53 43 34 -1 53 44 43 -1 53 34 52 -1 54 51 46 -1 54 46 36 -1 55 22 54 -1 55 23 22 -1 55 54 36 -1 55 36 31 -1 56 1 48 -1 56 48 52 -1 56 52 1 -1 57 31 23 -1 57 55 31 -1 57 23 55 -1 58 49 44 -1 58 52 51 -1 58 44 53 -1 59 53 52 -1 59 52 58 -1 59 58 53 -1 60 22 49 -1 60 51 54 -1 60 54 22 -1 60 58 51 -1 61 49 58 -1 61 58 60 -1 61 60 49 -1"
Global PUNKTE1.s ="-0.56860697269439697 0 0.92002600431442261 -0.32578301429748535 -0.52712798118591309 0.85291099548339844 0 0 1.0542559623718262 0.9670569896697998 0 0.36938300728797913 0.56860697269439697 0 0.92002600431442261 0.85291099548339844 -0.32578301429748535 0.52712798118591309 0.85291099548339844 0.32578301429748535 0.52712798118591309 0.59767401218414307 0.59767401218414307 0.59767401218414307 0.52712798118591309 0.85291099548339844 0.32578301429748535 0 0.92002600431442261 0.56860697269439697 0.32578301429748535 0.52712798118591309 0.85291099548339844 0 0.36938300728797913 0.9670569896697998 -0.32578301429748535 0.52712798118591309 0.85291099548339844 0.92002600431442261 0.56860697269439697 0 0.36938300728797913 0.9670569896697998 0 0.52712798118591309 0.85291099548339844 -0.32578301429748535 0 0.92002600431442261 -0.56860697269439697 0.32578301429748535 -0.52712798118591309 0.85291099548339844 0.32578301429748535 0.52712798118591309 -0.85291099548339844 0.56860697269439697 0 -0.92002600431442261 0 0 -1.0542559623718262 0 0.36938300728797913 -0.9670569896697998 -0.56860697269439697 0 -0.92002600431442261 -0.32578301429748535 0.52712798118591309 -0.85291099548339844 0 1.0542559623718262 0 1.0542559623718262 0 0 0.9670569896697998 0 -0.36938300728797913 0.85291099548339844 0.32578301429748535 -0.52712798118591309 -0.52712798118591309 0.85291099548339844 0.32578301429748535 0.59767401218414307 0.59767401218414307 -0.59767401218414307 0.92002600431442261 -0.56860697269439697 0 -0.52712798118591309 0.85291099548339844 -0.32578301429748535 0.85291099548339844 -0.32578301429748535 -0.52712798118591309 0.32578301429748535 -0.52712798118591309 -0.85291099548339844 0 -0.92002600431442261 0.56860697269439697 0.52712798118591309 -0.85291099548339844 0.32578301429748535 -0.92002600431442261 0.56860697269439697 0 -0.85291099548339844 0.32578301429748535 0.52712798118591309 0.59767401218414307 -0.59767401218414307 0.59767401218414307 -0.59767401218414307 0.59767401218414307 0.59767401218414307 0 -0.36938300728797913 0.9670569896697998 -0.36938300728797913 0.9670569896697998 0 0.52712798118591309 -0.85291099548339844 -0.32578301429748535 0.36938300728797913 -0.9670569896697998 0 0 -0.92002600431442261 -0.56860697269439697 -0.9670569896697998 0 0.36938300728797913 -1.0542559623718262 0 0 0.59767401218414307 -0.59767401218414307 -0.59767401218414307 -0.85291099548339844 -0.32578301429748535 0.52712798118591309 -0.32578301429748535 -0.52712798118591309 -0.85291099548339844 0 -0.36938300728797913 -0.9670569896697998 -0.92002600431442261 -0.56860697269439697 0 -0.52712798118591309 -0.85291099548339844 0.32578301429748535 0 -1.0542559623718262 0 -0.9670569896697998 0 -0.36938300728797913 -0.85291099548339844 0.32578301429748535 -0.52712798118591309 -0.59767401218414307 -0.59767401218414307 0.59767401218414307 -0.59767401218414307 0.59767401218414307 -0.59767401218414307 -0.52712798118591309 -0.85291099548339844 -0.32578301429748535 -0.36938300728797913 -0.9670569896697998 0 -0.85291099548339844 -0.32578301429748535 -0.52712798118591309 -0.59767401218414307 -0.59767401218414307 -0.59767401218414307"
Global INDICES2.s="0 1 2 -1 0 2 3 -1 0 3 1 -1 1 3 2 -1"
Global PUNKTE2.s ="0 0 1.7320510149002075 1.6329929828643799 0 -0.57735031843185425 -0.81649661064147949 1.414214015007019 -0.57735031843185425 -0.81649661064147949 -1.414214015007019 -0.57735031843185425"
Global INDICES3.s="0 1 2 -1 0 2 3 -1 0 3 4 -1 0 4 1 -1 1 4 5 -1 1 5 2 -1 2 5 3 -1 3 5 4 -1 "
Global PUNKTE3.s ="0 0 1.414214015007019 1.414214015007019 0 0 0 1.414214015007019 0 -1.414214015007019 0 0 0 -1.414214015007019 0 0 0 -1.414214015007019 "
Global INDICES4.s="0 1 2 -1 0 2 3 -1 0 3 4 -1 0 4 5 -1 0 5 1 -1 1 5 7 -1 1 7 6 -1 1 6 2 -1 2 6 8 -1 2 8 3 -1 3 8 9 -1 3 9 4 -1 4 9 10 -1 4 10 5 -1 5 10 7 -1 6 7 11 -1 6 11 8 -1 7 10 11 -1 8 11 9 -1 9 11 10 -1 "
Global PUNKTE4.s ="0 0 1.1755709648132324 1.0514620542526245 0 0.52573108673095703 0.32491970062255859 1 0.52573108673095703 -0.85065078735351563 0.6180340051651001 0.52573108673095703 -0.85065078735351563 -0.6180340051651001 0.52573108673095703 0.32491970062255859 -1 0.52573108673095703 0.85065078735351563 0.6180340051651001 -0.52573108673095703 0.85065078735351563 -0.6180340051651001 -0.52573108673095703 -0.32491970062255859 1 -0.52573108673095703 -1.0514620542526245 0 -0.52573108673095703 -0.32491970062255859 -1 -0.52573108673095703 0 0 -1.1755709648132324 "
Global INDICES5.s="0 1 2 -1 0 2 3 -1 0 3 4 -1 0 4 5 -1 0 5 1 -1 6 7 8 -1 6 8 9 -1 6 9 4 -1 6 4 3 -1 6 3 7 -1 10 7 3 -1 10 3 2 -1 10 2 11 -1 10 11 12 -1 10 12 7 -1 13 9 14 -1 13 14 15 -1 13 15 5 -1 13 5 4 -1 13 4 9 -1 16 2 1 -1 16 1 17 -1 16 17 18 -1 16 18 11 -1 16 11 2 -1 19 7 12 -1 19 12 20 -1 19 20 21 -1 19 21 8 -1 19 8 7 -1 22 9 8 -1 22 8 21 -1 22 21 23 -1 22 23 14 -1 22 14 9 -1 24 1 5 -1 24 5 15 -1 24 15 25 -1 24 25 17 -1 24 17 1 -1 26 12 11 -1 26 11 18 -1 26 18 27 -1 26 27 20 -1 26 20 12 -1 28 23 29 -1 28 29 25 -1 28 25 15 -1 28 15 14 -1 28 14 23 -1 30 18 17 -1 30 17 25 -1 30 25 29 -1 30 29 27 -1 30 27 18 -1 31 23 21 -1 31 21 20 -1 31 20 27 -1 31 27 29 -1 31 29 23 -1"
Global PUNKTE5.s ="0.378886 9.53674e-09 0.61305 0.847214 0 0.323606 0.523606 0.523606 0.523606 0 0.323606 0.847214 0 -0.323606 0.847214 0.523606 -0.523606 0.523606 -0.378886 0 0.61305 -0.523606 0.523606 0.523606 -0.847214 0 0.323606 -0.523606 -0.523606 0.523606 0 0.61305 0.378886 0.323606 0.847214 0 -0.323606 0.847214 0 -9.53674e-09 -0.61305 0.378886 -0.323606 -0.847214 0 0.323606 -0.847214 0 0.61305 0.378886 9.53674e-09 0.847214 0 -0.323606 0.523606 0.523606 -0.523606 -0.61305 0.378886 0 -0.523606 0.523606 -0.523606 -0.847214 0 -0.323606 -0.61305 -0.378886 9.53674e-09 -0.523606 -0.523606 -0.523606 0.61305 -0.378886 4.76838e-09 0.523606 -0.523606 -0.523606 0 0.61305 -0.378886 0 0.323606 -0.847214 0 -0.61305 -0.378886 0 -0.323606 -0.847214 0.378886 0 -0.61305 -0.378886 0 -0.61305"
Global INDICES6.s="0 13 12 -1 1 13 15 -1 0 12 17 -1 0 17 19 -1 0 19 16 -1 1 15 22 -1 2 14 24 -1 3 18 26 -1 4 20 28 -1 5 21 30 -1 1 22 25 -1 2 24 27 -1 3 26 29 -1 4 28 31 -1 5 30 23 -1 6 32 37 -1 7 33 39 -1 8 34 40 -1 9 35 41 -1 10 36 38 -1 38 41 11 -1 38 36 41 -1 36 9 41 -1 41 40 11 -1 41 35 40 -1 35 8 40 -1 40 39 11 -1 40 34 39 -1 34 7 39 -1 39 37 11 -1 39 33 37 -1 33 6 37 -1 37 38 11 -1 37 32 38 -1 32 10 38 -1 23 36 10 -1 23 30 36 -1 30 9 36 -1 31 35 9 -1 31 28 35 -1 28 8 35 -1 29 34 8 -1 29 26 34 -1 26 7 34 -1 27 33 7 -1 27 24 33 -1 24 6 33 -1 25 32 6 -1 25 22 32 -1 22 10 32 -1 30 31 9 -1 30 21 31 -1 21 4 31 -1 28 29 8 -1 28 20 29 -1 20 3 29 -1 26 27 7 -1 26 18 27 -1 18 2 27 -1 24 25 6 -1 24 14 25 -1 14 1 25 -1 22 23 10 -1 22 15 23 -1 15 5 23 -1 16 21 5 -1 16 19 21 -1 19 4 21 -1 19 20 4 -1 19 17 20 -1 17 3 20 -1 17 18 3 -1 17 12 18 -1 12 2 18 -1 15 16 5 -1 15 13 16 -1 13 0 16 -1 12 14 2 -1 12 13 14 -1 13 1 14 -1 "
Global PUNKTE6.s ="0.000000 0.000000 -1.000000 0.723607 -0.525725 -0.447220 -0.276388 -0.850649 -0.447220 -0.894426 0.000000 -0.447216 -0.276388 0.850649 -0.447220 0.723607 0.525725 -0.447220 0.276388 -0.850649 0.447220 -0.723607 -0.525725 0.447220 -0.723607 0.525725 0.447220 0.276388 0.850649 0.447220 0.894426 0.000000 0.447216 0.000000 0.000000 1.000000 -0.162456 -0.499995 -0.850654 0.425323 -0.309011 -0.850654 0.262869 -0.809012 -0.525738 0.850648 0.000000 -0.525736 0.425323 0.309011 -0.850654 -0.525730 0.000000 -0.850652 -0.688189 -0.499997 -0.525736 -0.162456 0.499995 -0.850654 -0.688189 0.499997 -0.525736 0.262869 0.809012 -0.525738 0.951058 -0.309013 0.000000 0.951058 0.309013 0.000000 0.000000 -1.000000 0.000000 0.587786 -0.809017 0.000000 -0.951058 -0.309013 0.000000 -0.587786 -0.809017 0.000000 -0.587786 0.809017 0.000000 -0.951058 0.309013 0.000000 0.587786 0.809017 0.000000 0.000000 1.000000 0.000000 0.688189 -0.499997 0.525736 -0.262869 -0.809012 0.525738 -0.850648 0.000000 0.525736 -0.262869 0.809012 0.525738 0.688189 0.499997 0.525736 0.162456 -0.499995 0.850654 0.525730 0.000000 0.850652 -0.425323 -0.309011 0.850654 -0.425323 0.309011 0.850654 0.162456 0.499995 0.850654 "

Procedure Main()
  
  Protected AnzI.i=0,AnzP.i=0,Pos.i=0,i.i
  Protected Zahl.s
  
  Repeat
    Pos = FindString(INDICES1," ",Pos+1)
    AnzI + 1
  Until Pos=0
  Repeat
    Pos = FindString(PUNKTE1," ",Pos+1)
    AnzP + 1
  Until Pos=0
  
  AnzI / 4
  AnzP / 3
  
  Protected Dim Indices.i(AnzI,3)
  Protected Dim Punkte.f(AnzP,2)
  
  For i=0 To AnzI
    Zahl = StringField(INDICES1,i*4+1," ")
    Indices(i,0) = Val(Zahl)
    Zahl = StringField(INDICES1,i*4+2," ")
    Indices(i,1) = Val(Zahl)
    Zahl = StringField(INDICES1,i*4+3," ")
    Indices(i,2) = Val(Zahl)
    Zahl = StringField(INDICES1,i*4+4," ")
    Indices(i,3) = Val(Zahl)
  Next i
  
  For i=0 To AnzP
    Zahl = StringField(PUNKTE1,i*3+1," ")
    Punkte(i,0) = ValF(Zahl)
    Zahl = StringField(PUNKTE1,i*3+2," ")
    Punkte(i,1) = ValF(Zahl)
    Zahl = StringField(PUNKTE1,i*3+3," ")
    Punkte(i,2) = ValF(Zahl)
  Next i
  
  Select PunktInAllgemeinemPolyeder(AnzI,Indices(),Punkte(),3.0,3.0,3.0)
    Case -1
      MessageRequester("Allgemein Lage","aussen")
    Case 0
      MessageRequester("Allgemein Lage","Rand")
    Case 1
      MessageRequester("Allgemein Lage","innen")
  EndSelect
  Select PunktInKonvexemPolyeder(AnzI,Indices(),Punkte(),3.0,3.0,3.0)
    Case -1
      MessageRequester("Konvex Lage","aussen")
    Case 0
      MessageRequester("Konvex Lage","Rand")
    Case 1
      MessageRequester("Konvex Lage","innen")
  EndSelect
EndProcedure

Main()
Die Parameter (Indizes,Punkte) habe ich nach dem Beispiel von tft gemacht.

Re: Formel für Berechnung gesucht.

Verfasst: 10.04.2021 10:06
von tft
super genial ... danke

Gruss TFT