Prozeduren für 3D-Körper
Verfasst: 02.09.2005 21:14
Hier ist eine große Formelsammlung für 3D-Körper als Funktionen
Ich glaube ich erweitere das ganze noch. Vielleicht kann es ja irgendeiner mal brauchen...

Code: Alles auswählen
;-|------------------------|
;-| Mathe V0.2 |
;-|~~~~~~~~~~~~~~~~~~~~~~~~|
;-| by AndyX 2005 |
;-|________________________|
;- Beschreibung:
;- Ein riesiger Haufen voll unnötiger Prozeduren...
;-
#PI = 3.14159265
;{- Cube
Procedure.f CubeGetSurface(a.f)
ProcedureReturn 6 * (a * a)
EndProcedure
Procedure.f CubeGetVolume(a.f)
ProcedureReturn Pow(a,3)
EndProcedure
Procedure.f CubeGetEdge(o.f)
ProcedureReturn Sqr(o/6)
EndProcedure
;}
;{- Cubiod
Procedure.f CubiodGetSurface(a.f,b.f,c.f)
ProcedureReturn 2 * (a * b + b * c + a * c)
EndProcedure
Procedure.f CubiodGetVolume(a.f,b.f,c.f)
ProcedureReturn a * b * c
EndProcedure
Procedure.f CubiodGetLength(o.f,b.f,c.f)
ProcedureReturn ((o / 2) - b * c) / (b + c)
EndProcedure
Procedure.f CubiodGetLength_(v.f,b.f,c.f)
ProcedureReturn v / (c * b)
EndProcedure
Procedure.f CubiodGetWidth(o.f,a.f,c.f)
ProcedureReturn ((o / 2) - a * c) / (a + c)
EndProcedure
Procedure.f CubiodGetWidth_(v.f,a.f,c.f)
ProcedureReturn v / (c * a)
EndProcedure
Procedure.f CubiodGetHeigth(o.f,a.f,b.f)
ProcedureReturn ((o / 2) - a * b) / (a + b)
EndProcedure
Procedure.f CubiodGetHeigth_(v.f,a.f,b.f)
ProcedureReturn v / (a * b)
EndProcedure
;}
;{- Tetrahedron
Procedure.f TetrahedronGetSurface(a.f)
ProcedureReturn (a * a) * Sqr(3)
EndProcedure
Procedure.f TetrahedronGetVolume(a.f)
ProcedureReturn (Pow(a,3) / 12) * Sqr(2)
EndProcedure
Procedure.f TetrahedronGetEdge(o.f)
ProcedureReturn Sqr(o / Sqr(3))
EndProcedure
;}
;{- Pyramid (square)
Procedure.f PyramidGetBottomSurfaceEdge(v.f,h.f)
ProcedureReturn Sqr((3 * v) / h)
EndProcedure
Procedure.f PyramidGetBottomSurfaceEdge_(hs.f,h.f)
ProcedureReturn 2 * Sqr((hs * hs) - (h * h))
EndProcedure
Procedure.f PyramidGetBottomSurfaceEdge__(s.f,hs.f)
ProcedureReturn 2 * Sqr((s * s) - (hs * hs))
EndProcedure
Procedure.f PyramidGetBottomSurfaceEdge___(m.f,hs.f)
ProcedureReturn (m / hs) / 2
EndProcedure
Procedure.f PyramidGetBottomSurfaceEdge____(g.f)
ProcedureReturn Sqr(g)
EndProcedure
Procedure.f PyramidGetBottomSurfaceEdge_____(o.f,m.f)
ProcedureReturn Sqr(o - m)
EndProcedure
Procedure.f PyramidGetBottomSurface(a.f)
ProcedureReturn a * a
EndProcedure
Procedure.f PyramidGetBottomSurface_(o.f,m.f)
ProcedureReturn o - m
EndProcedure
Procedure.f PyramidGetHeigth(v.f,a.f)
ProcedureReturn (v * 3) / (a * a)
EndProcedure
Procedure.f PyramidGetHeigth_(hs.f,a.f)
ProcedureReturn Sqr((hs * hs) - Pow((a / 2),2))
EndProcedure
Procedure.f PyramidGetSlantingUp(hs.f,a.f)
ProcedureReturn Sqr((hs * hs) + Pow((a / 2),2))
EndProcedure
Procedure.f PyramidGetCoatPartHeight(m.f,a.f)
ProcedureReturn m / (2 * a)
EndProcedure
Procedure.f PyramidGetCoatPartHeight_(h.f,a.f)
ProcedureReturn Sqr((h * h) + Pow((a / 2),2))
EndProcedure
Procedure.f PyramidGetCoatPartHeight__(s.f,a.f)
ProcedureReturn Sqr((s * s) - Pow((a / 2),2))
EndProcedure
Procedure.f PyramidGetVolume(g.f,h.f)
ProcedureReturn (1 / 3) * g * h
EndProcedure
Procedure.f PyramidGetSurface(a.f,hs.f)
ProcedureReturn (a * a) + 2 * a * hs
EndProcedure
Procedure.f PyramidGetSurface_(g.f,m.f)
ProcedureReturn g + m
EndProcedure
Procedure.f PyramidGetCoat(o.f,g.f)
ProcedureReturn o - g
EndProcedure
Procedure.f PyramidGetCoat_(a.f,hs.f)
ProcedureReturn 2 * a * hs
EndProcedure
;}
;{- Sphere
Procedure.f SphereGetSurface(r.f)
ProcedureReturn 4 * #PI * (r * r)
EndProcedure
Procedure.f SphereGetVolume(r.f)
ProcedureReturn (4/3) * #PI * Pow(r,3)
EndProcedure
Procedure.f SphereGetDiameter(r.f)
ProcedureReturn r * 2
EndProcedure
Procedure.f SphereGetRadius(d.f)
ProcedureReturn d / 2
EndProcedure
Procedure.f SphereGetRadius_(o.f)
ProcedureReturn Sqr(o / (4 * #PI))
EndProcedure
;}
;{- Cylinder
Procedure.f CylinderGetBottomSurface(r.f)
ProcedureReturn (r * r) * #PI
EndProcedure
Procedure.f CylinderGetBottomSurface_(o.f,m.f)
ProcedureReturn (o - m) / 2
EndProcedure
Procedure.f CylinderGetCoat(o.f,a.f)
ProcedureReturn o - (2 * a)
EndProcedure
Procedure.f CylinderGetVolume(r.f,h.f)
ProcedureReturn #PI * (r * r) * h
EndProcedure
Procedure.f CylinderGetBottomSurfaceRadius(v.f,h.f)
ProcedureReturn Sqr(v / (h * #PI))
EndProcedure
Procedure.f CylinderGetBottomSurfaceRadius_(a.f)
ProcedureReturn Sqr(a / #PI)
EndProcedure
Procedure.f CylinderGetBottomSurfaceRadius__(o.f,m.f)
ProcedureReturn Sqr((o - m) / (2 * #PI))
EndProcedure
Procedure.f CylinderGetSurface(r.f,h.f)
ProcedureReturn 2 * #PI * r * (r + h)
EndProcedure
Procedure.f CylinderGetSurface_(m.f,a.f)
ProcedureReturn m + 2 * a
EndProcedure
Procedure.f CylinderGetHeight(o.f,r.f)
ProcedureReturn (o / (2 * r * #PI)) - r
EndProcedure
Procedure.f CylinderGetHeight_(v.f,r.f)
ProcedureReturn v / ((r * r) * #PI)
EndProcedure
;}
;{- Cone
Procedure.f ConeGetAlpha(r.f,s.f)
ProcedureReturn (r / s) * 360
EndProcedure
Procedure.f ConeGetBottomSurface(o.f,m.f)
ProcedureReturn o - m
EndProcedure
Procedure.f ConeGetBottomSurface_(r.f)
ProcedureReturn #PI * (r * r)
EndProcedure
Procedure.f ConeGetSurface(r.f,s.f)
ProcedureReturn #PI * (r * r) + #PI * r * s
EndProcedure
Procedure.f ConeGetCoat(r.f,s.f)
ProcedureReturn #PI * r * s
EndProcedure
Procedure.f ConeGetCoat_(o.f,g.f)
ProcedureReturn o - g
EndProcedure
Procedure.f ConeGetHeigth(r.f,s.f)
ProcedureReturn Sqr((s * s) - (r * r))
EndProcedure
Procedure.f ConeGetHeigth_(v.f,r.f)
ProcedureReturn v / ((#PI / 3) * (r * r))
EndProcedure
Procedure.f ConeGetVolume(r.f,h.f)
ProcedureReturn (#PI / 3) * (r * r) * h
EndProcedure
Procedure.f ConeGetSlantingUp(m.f,r.f)
ProcedureReturn m / (#PI * r)
EndProcedure
Procedure.f ConeGetSlantingUp_(r.f,alpha.f)
ProcedureReturn (r * 360) / alpha
EndProcedure
Procedure.f ConeGetSlantingUp__(r.f,h.f)
ProcedureReturn Sqr((r * r) + (h * h))
EndProcedure
Procedure.f ConeGetSlantingUp___(r.f,alpha.f)
ProcedureReturn (r / alpha) * 360
EndProcedure
Procedure.f ConeGetBottomSurfaceRadius(g.f)
ProcedureReturn Sqr(g / #PI)
EndProcedure
Procedure.f ConeGetBottomSurfaceRadius_(v.f,h.f)
ProcedureReturn Sqr(v / (h * (#PI / 3)))
EndProcedure
Procedure.f ConeGetBottomSurfaceRadius__(alpha.f,s.f)
ProcedureReturn (alpha * s) / 360
EndProcedure
Procedure.f ConeGetBottomSurfaceRadius___(s.f,h.f)
ProcedureReturn Sqr((s * s) - (h * h))
EndProcedure
Procedure.f ConeGetBottomSurfaceRadius____(s.f,o.f)
ProcedureReturn -(s / 2) + Sqr(Pow(s / 2,2) + (o / #PI))
EndProcedure
;}
;{- ##### TESTS #####
Debug "------- Cube -------"
Debug CubeGetSurface(2)
Debug CubeGetVolume(3)
Debug CubeGetEdge(96)
Debug "------ Cubiod ------"
Debug CubiodGetSurface(3.5,2.6,3.8)
Debug CubiodGetVolume(3.5,2.6,3.8)
Debug CubiodGetLength(64.559998,2.6,3.8)
Debug CubiodGetLength_(34.579998,2.6,3.8)
Debug CubiodGetWidth(64.559998,3.5,3.8)
Debug CubiodGetWidth_(34.579998,3.5,3.8)
Debug CubiodGetHeigth(64.559998,2.6,3.5)
Debug CubiodGetHeigth_(34.579998,2.6,3.5)
Debug "---- Tetrahedron ---"
Debug TetrahedronGetSurface(5.5)
Debug TetrahedronGetVolume(5.5)
Debug TetrahedronGetEdge(52.394535)
Debug "----- Pyramid ------"
Debug PyramidGetBottomSurfaceEdge(286.216705,13.416408)
Debug PyramidGetBottomSurfaceEdge_(14,13.416408)
Debug PyramidGetBottomSurfaceEdge__(14.560220,14)
Debug PyramidGetBottomSurfaceEdge___(224,14)
Debug PyramidGetBottomSurfaceEdge____(64)
Debug PyramidGetBottomSurfaceEdge_____(288,224)
Debug PyramidGetBottomSurface(8)
Debug PyramidGetBottomSurface_(288,224)
Debug PyramidGetHeigth(286.216705,8)
Debug PyramidGetHeigth_(14,8)
Debug PyramidGetSlantingUp(14,8)
Debug PyramidGetCoatPartHeight(224,8)
Debug PyramidGetCoatPartHeight_(13.416408,8)
Debug PyramidGetCoatPartHeight__(14.560220,8)
Debug PyramidGetVolume(64,13.416408)
Debug PyramidGetSurface(8,14)
Debug PyramidGetSurface_(64,224)
Debug PyramidGetCoat(288,64)
Debug PyramidGetCoat_(8,14)
Debug "------ Sphere ------"
Debug SphereGetSurface(6)
Debug SphereGetVolume(6)
Debug SphereGetDiameter(6)
Debug SphereGetRadius(12)
Debug SphereGetRadius_(452.389343)
Debug "----- Cylinder -----"
Debug CylinderGetBottomSurface(2)
Debug CylinderGetBottomSurface_(60.200005,35.067261)
Debug CylinderGetCoat(60.200005,12.566371)
Debug CylinderGetVolume(2,2.790564)
Debug CylinderGetBottomSurfaceRadius(35.067265,2.790564)
Debug CylinderGetBottomSurfaceRadius_(12.566371)
Debug CylinderGetBottomSurfaceRadius__(60.200005,35.067261)
Debug CylinderGetSurface(2,2.790564)
Debug CylinderGetSurface_(35.067261,12.566371)
Debug CylinderGetHeight(60.200005,2)
Debug CylinderGetHeight_(35.067265,2)
Debug "------- Cone -------"
Debug ConeGetAlpha(3.534,7.46544)
Debug ConeGetBottomSurface(122.120056,82.884216)
Debug ConeGetBottomSurface_(3.534)
Debug ConeGetSurface(3.534,7.46544)
Debug ConeGetCoat(3.534,7.46544)
Debug ConeGetCoat_(122.120056,39.235840)
Debug ConeGetHeigth(3.534,7.46544)
Debug ConeGetHeigth_(86.004814,3.534)
Debug ConeGetVolume(3.534,6.575989)
Debug ConeGetSlantingUp(82.884216,3.534)
Debug ConeGetSlantingUp_(3.534,170.417282)
Debug ConeGetSlantingUp__(3.534,6.575989)
Debug ConeGetSlantingUp___(3.534,170.417282)
Debug ConeGetBottomSurfaceRadius(39.235840)
Debug ConeGetBottomSurfaceRadius_(86.004814,6.575989)
Debug ConeGetBottomSurfaceRadius__(170.417282,7.46544)
Debug ConeGetBottomSurfaceRadius___(7.46544,6.575989)
Debug ConeGetBottomSurfaceRadius____(7.46544,122.120056)
;}