GSOF-3dWireFrame 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. gsof_3dwireframe-1.1.0/GSOF_3dWireFrame/Drone_Class.py +64 -0
  2. gsof_3dwireframe-1.1.0/GSOF_3dWireFrame/Example_Drone.py +150 -0
  3. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/F16_Class.py +1 -1
  4. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame.egg-info/PKG-INFO +6 -2
  5. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame.egg-info/SOURCES.txt +2 -0
  6. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/PKG-INFO +6 -2
  7. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/README.md +5 -1
  8. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/pyproject.toml +1 -1
  9. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/AUTHORS +0 -0
  10. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Example_F16.py +0 -0
  11. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Example_dynamicWorld.py +0 -0
  12. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Example_motionWorld.py +0 -0
  13. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Example_staticWorld.py +0 -0
  14. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/Assembly.py +0 -0
  15. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/Lib3D.py +0 -0
  16. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/Object_WireFrame.py +0 -0
  17. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/Object_base.py +0 -0
  18. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/Objects.py +0 -0
  19. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/Utils.py +0 -0
  20. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/WireFrame_display.py +0 -0
  21. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/__init__.py +0 -0
  22. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/Lib3D/stlToObj.py +0 -0
  23. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/MathLib/MathLib.py +0 -0
  24. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/MathLib/__init__.py +0 -0
  25. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/attitudeViewer.py +0 -0
  26. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/modules/AttitudeViewer_class.py +0 -0
  27. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/modules/Controls.py +0 -0
  28. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/modules/__init__.py +0 -0
  29. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/Axis.json +0 -0
  30. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/F16.stl +0 -0
  31. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/LandingGear.json +0 -0
  32. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/Plume.json +0 -0
  33. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/Spark.json +0 -0
  34. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/cube.json +0 -0
  35. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/cube_flex.json +0 -0
  36. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/frame.json +0 -0
  37. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/house.json +0 -0
  38. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/net.json +0 -0
  39. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/plane.stl +0 -0
  40. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/objects/pyramid.json +0 -0
  41. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame/stlToObject.py +0 -0
  42. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame.egg-info/dependency_links.txt +0 -0
  43. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame.egg-info/requires.txt +0 -0
  44. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/GSOF_3dWireFrame.egg-info/top_level.txt +0 -0
  45. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/LICENSE +0 -0
  46. {gsof_3dwireframe-1.0.0 → gsof_3dwireframe-1.1.0}/setup.cfg +0 -0
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/python
2
+ """
3
+ * F16_Class.py
4
+ * Created on: 6 Jan 2025
5
+ * Improved for: 25 May 2026
6
+ * Author: Tzur Soffer
7
+ * Copyright (C) 2026 Tzur Soffer
8
+ """
9
+
10
+ import copy
11
+ try:
12
+ from GSOF_3dWireFrame.Lib3D.Object_WireFrame import Object_wireFrame as Object
13
+ from GSOF_3dWireFrame.Lib3D.Assembly import Assembly
14
+ from GSOF_3dWireFrame.Lib3D.Utils import Colors
15
+ except:
16
+ print("GSOF_Wireframe3D module isn't installed")
17
+
18
+ class View(Assembly):
19
+ """Constructs the gauges screen"""
20
+ def __init__(self, folder='./'):
21
+ self.time = 0.0
22
+ axis = Object(
23
+ filename="%s/objects/axis.json"%folder, color=Colors.GREEN)\
24
+ .scale(50.0)\
25
+ .translate(0, 0, 150)\
26
+ .setOrigin()
27
+
28
+ self.drone = Object(
29
+ filename="%s/objects/Drone/Body.stl"%folder, color=Colors.BLUE)\
30
+ .setCenter(scale=1.0, method="arithCenter")
31
+
32
+ propellorObj = Object(filename="%s/objects/Drone/Blade.stl"%folder, color=Colors.RED)\
33
+ .translate(0,20,0)\
34
+ .setCenter(scale=1.0, method="arithCenter")\
35
+ .setOrigin()
36
+
37
+ self.propellorA = copy.deepcopy(propellorObj)
38
+ self.propellorB = copy.deepcopy(propellorObj)
39
+ self.propellorC = copy.deepcopy(propellorObj)
40
+ self.propellorD = copy.deepcopy(propellorObj)
41
+
42
+ self.propellorA.color = Colors.RED
43
+ self.propellorB.color = Colors.BLACK
44
+ self.propellorC.color = Colors.GRAY
45
+ self.propellorD.color = Colors.YELLOW
46
+
47
+ super().__init__(objects=(axis, self.drone,
48
+ Assembly(objects=(self.propellorA,)).translate(-95,0,-90).setOrigin(),
49
+ Assembly(objects=(self.propellorB,)).translate(100,0,-90).setOrigin(),
50
+ Assembly(objects=(self.propellorC,)).translate(90,0,100).setOrigin(),
51
+ Assembly(objects=(self.propellorD,)).translate(-85,0,100).setOrigin()
52
+ ))
53
+
54
+ def setPropellorRps(self, propellor, rps) -> None:
55
+ propellor.rotate(x=0, y=rps*self.time*6.28, z=0)
56
+
57
+ def setPropellors(self, A, B, C, D) -> None:
58
+ self.setPropellorRps(self.propellorA, A)
59
+ self.setPropellorRps(self.propellorB, B)
60
+ self.setPropellorRps(self.propellorC, C)
61
+ self.setPropellorRps(self.propellorD, D)
62
+
63
+ def tick(self, dt):
64
+ self.time+=dt
@@ -0,0 +1,150 @@
1
+ #!/usr/bin/python
2
+ """
3
+ * Example_F16.py
4
+ * Created on: 31 May 2026
5
+ * Improved for: 31 May 2026
6
+ * Author: Tzur Soffer
7
+ * Copyright (C) 2026 Tzur Soffer
8
+ """
9
+ import pygame, math
10
+ from MathLib import MathLib
11
+ from Lib3D.Object_WireFrame import Object_wireFrame
12
+ from Lib3D.Assembly import Assembly
13
+ from Lib3D import Objects
14
+ from Lib3D import WireFrame_display as DISP
15
+ from Lib3D.Utils import Colors
16
+ from Drone_Class import View
17
+
18
+ SCREEN_WIDTH = 800
19
+ SCREEN_HEIGHT = 600
20
+ PI = math.pi
21
+
22
+ def drawWireFrame(screen, obj, color=None) -> None:
23
+ for line in obj.getLines():
24
+ x0, y0, z0 = line.p0
25
+ x1, y1, z1 = line.p1
26
+ lcolor = color
27
+ if lcolor == None:
28
+ lcolor = line.color
29
+ pygame.draw.line( screen, lcolor, (x0, y0), (x1, y1) ) #< Line from P0 to P1
30
+
31
+ def clearScreen(screen, color=(255,255,255)) -> None:
32
+ screen.fill(color)
33
+
34
+ def newScreen(title="New", resX=SCREEN_WIDTH, resY=SCREEN_HEIGHT, color=Colors.WHITE):
35
+ screenSize = (resX, resY)
36
+ screen = pygame.display.set_mode( screenSize )
37
+ clearScreen(screen, color)
38
+ pygame.display.set_caption(title)
39
+ return screen
40
+
41
+ def rotatePR(p, r, yaw):
42
+ R = MathLib.DCM_V2(yaw)
43
+ return MathLib.MxV_2x2(R, [p, r])
44
+
45
+ def quadMix(p, r):
46
+ M = [
47
+ [ 1, -1], # A
48
+ [ 1, 1], # B
49
+ [-1, 1], # C
50
+ [-1, -1], # D
51
+ ]
52
+ return MathLib.MxV(M, [p, r])
53
+
54
+ def computePropellers(maxRps, p, r, yaw):
55
+ p2, r2 = rotatePR(p, r, yaw)
56
+
57
+ props = quadMix(p2, r2) # mix WITHOUT maxRps first
58
+
59
+ # Normalize
60
+ maxVal = 0
61
+ for v in props:
62
+ if abs(v) > maxVal:
63
+ maxVal = abs(v)
64
+
65
+ # Scale if needed
66
+ if maxVal > 1.0:
67
+ props = MathLib.scaleV(props, 1.0 / maxVal)
68
+
69
+ # Apply maxRps
70
+ props = MathLib.scaleV(props, maxRps)
71
+
72
+ A = MathLib.clip(props[0], -maxRps, maxRps)
73
+ B = MathLib.clip(props[1], -maxRps, maxRps)
74
+ C = MathLib.clip(props[2], -maxRps, maxRps)
75
+ D = MathLib.clip(props[3], -maxRps, maxRps)
76
+
77
+ return A, B, C, D
78
+
79
+ def sign(val):
80
+ if val >= 0:
81
+ return 1
82
+ return -1
83
+
84
+
85
+ if __name__ == "__main__":
86
+ pygame.init()
87
+ ground = Object_wireFrame(
88
+ obj=Objects.net(25,25), color=(0,100,0))\
89
+ .scale(0.2)\
90
+ .rotate(x=math.pi/2, y=0, z=0)\
91
+ .translate(-250, -200, -250)\
92
+ .setOrigin()
93
+
94
+ drone = View()\
95
+ .scale(1.0)\
96
+ .translate(100, 100, -100).setOrigin()
97
+
98
+ world = Assembly(objects=(ground, drone)).translate(0,0,-1000).setOrigin()
99
+
100
+ clock = pygame.time.Clock()
101
+ screen = newScreen("3D Wire Frame Shapes", SCREEN_WIDTH, SCREEN_HEIGHT, Colors.WHITE)
102
+ wireframe = DISP.WireFrame(screen, pygame.draw.line, f=50, scale=20.0)
103
+
104
+ fps = 30
105
+ maxRps = 2
106
+ dt = 1/fps
107
+ t = 0
108
+ useMouse = True
109
+ mPosZ = 0
110
+ run = True
111
+ while run:
112
+ for event in pygame.event.get():
113
+ if event.type == pygame.QUIT:
114
+ run = False
115
+ world.reset()
116
+ clearScreen(screen)
117
+
118
+ keys = pygame.key.get_pressed()
119
+
120
+ if useMouse:
121
+ (mPosX, mPosY) = pygame.mouse.get_pos()
122
+ mPosZ += (keys[pygame.K_z] -keys[pygame.K_x])*2
123
+ x = mPosX/SCREEN_WIDTH -0.5
124
+ y = mPosY/SCREEN_HEIGHT -0.5
125
+ z = mPosZ/360
126
+ else:
127
+ x += 0.5*dt
128
+ y += 1*dt
129
+ z = 0
130
+ camAngX_r = y*PI
131
+ camAngY_r = z*PI
132
+ camAngZ_r = x*PI
133
+
134
+ print(computePropellers(maxRps, camAngX_r, camAngY_r, camAngZ_r))
135
+ A, B, C, D = computePropellers(maxRps/2, camAngX_r, camAngY_r, camAngZ_r)
136
+ A+=maxRps/2*sign(A)
137
+ B+=maxRps/2*sign(B)
138
+ C+=maxRps/2*sign(C)
139
+ D+=maxRps/2*sign(D)
140
+ drone.setPropellors(A, B, C, D)
141
+ drone.rotate(-camAngX_r,-camAngY_r,-camAngZ_r, centerAt=(100, 100, -100))
142
+ drone.tick(dt)
143
+ wireframe.draw(world)
144
+
145
+ t += dt
146
+ clock.tick(30)
147
+
148
+ pygame.display.flip()
149
+
150
+ pygame.quit()
@@ -73,7 +73,7 @@ class F16_View(Assembly):
73
73
  filename="%s/objects/f16.stl"%folder, color=BLUE, name="F16")\
74
74
  .setCenter(scale=1.0, method="arithCenter")
75
75
 
76
- self.plume = objects=Object(
76
+ self.plume = Object(
77
77
  filename="%s/objects/Plume.json"%folder, color=RED)\
78
78
  .setCenter(scale=30, rotate=(180*degToRad, 0, 0))
79
79
  plume = Assembly(objects=(self.plume,))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GSOF_3dWireFrame
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: A 3D wireframe rendering library built on Pygame
5
5
  Author-email: Guy Soffer <gsoffer@yahoo.com>
6
6
  License: GPL-3.0-or-later
@@ -25,7 +25,7 @@ License-File: AUTHORS
25
25
  Requires-Dist: pygame
26
26
  Dynamic: license-file
27
27
 
28
- # 3dWireFrame
28
+ # GSOF_3dWireFrame
29
29
  Simple and basic 3D Wire-Frame drawing program.
30
30
  - Loads .stl or .json object files.
31
31
  - Supports assembly containers to manipulate object in their own frame of reference.
@@ -36,13 +36,17 @@ Simple and basic 3D Wire-Frame drawing program.
36
36
  ## Running instructions
37
37
  ## Using pip (recommened)
38
38
  - run `pip install GSOF_3dWireFrame`
39
+
39
40
  ## Manual install
40
41
  - Clone
41
42
  - Install requirements `pip install -r requirements.txt`
42
43
  - run `pip install .`
43
44
  - Open and run one of the code examples (e.g. `Example_staticWorld.py`)
44
45
 
46
+ ![alt text](./Documentation/3DWireFrame_quadcopter.gif "Animation")
47
+
45
48
  ![alt text](./Documentation/3DWireFrame_interactive.gif "Animation")
46
49
 
47
50
  ![alt text](./Documentation/3DWireFrame_flex.gif "Screenshot")
48
51
 
52
+ ## This project is licensed under MIT LICENSE, see LICENSE file for more info.
@@ -2,6 +2,8 @@ AUTHORS
2
2
  LICENSE
3
3
  README.md
4
4
  pyproject.toml
5
+ GSOF_3dWireFrame/Drone_Class.py
6
+ GSOF_3dWireFrame/Example_Drone.py
5
7
  GSOF_3dWireFrame/Example_F16.py
6
8
  GSOF_3dWireFrame/Example_dynamicWorld.py
7
9
  GSOF_3dWireFrame/Example_motionWorld.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GSOF_3dWireFrame
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: A 3D wireframe rendering library built on Pygame
5
5
  Author-email: Guy Soffer <gsoffer@yahoo.com>
6
6
  License: GPL-3.0-or-later
@@ -25,7 +25,7 @@ License-File: AUTHORS
25
25
  Requires-Dist: pygame
26
26
  Dynamic: license-file
27
27
 
28
- # 3dWireFrame
28
+ # GSOF_3dWireFrame
29
29
  Simple and basic 3D Wire-Frame drawing program.
30
30
  - Loads .stl or .json object files.
31
31
  - Supports assembly containers to manipulate object in their own frame of reference.
@@ -36,13 +36,17 @@ Simple and basic 3D Wire-Frame drawing program.
36
36
  ## Running instructions
37
37
  ## Using pip (recommened)
38
38
  - run `pip install GSOF_3dWireFrame`
39
+
39
40
  ## Manual install
40
41
  - Clone
41
42
  - Install requirements `pip install -r requirements.txt`
42
43
  - run `pip install .`
43
44
  - Open and run one of the code examples (e.g. `Example_staticWorld.py`)
44
45
 
46
+ ![alt text](./Documentation/3DWireFrame_quadcopter.gif "Animation")
47
+
45
48
  ![alt text](./Documentation/3DWireFrame_interactive.gif "Animation")
46
49
 
47
50
  ![alt text](./Documentation/3DWireFrame_flex.gif "Screenshot")
48
51
 
52
+ ## This project is licensed under MIT LICENSE, see LICENSE file for more info.
@@ -1,4 +1,4 @@
1
- # 3dWireFrame
1
+ # GSOF_3dWireFrame
2
2
  Simple and basic 3D Wire-Frame drawing program.
3
3
  - Loads .stl or .json object files.
4
4
  - Supports assembly containers to manipulate object in their own frame of reference.
@@ -9,13 +9,17 @@ Simple and basic 3D Wire-Frame drawing program.
9
9
  ## Running instructions
10
10
  ## Using pip (recommened)
11
11
  - run `pip install GSOF_3dWireFrame`
12
+
12
13
  ## Manual install
13
14
  - Clone
14
15
  - Install requirements `pip install -r requirements.txt`
15
16
  - run `pip install .`
16
17
  - Open and run one of the code examples (e.g. `Example_staticWorld.py`)
17
18
 
19
+ ![alt text](./Documentation/3DWireFrame_quadcopter.gif "Animation")
20
+
18
21
  ![alt text](./Documentation/3DWireFrame_interactive.gif "Animation")
19
22
 
20
23
  ![alt text](./Documentation/3DWireFrame_flex.gif "Screenshot")
21
24
 
25
+ ## This project is licensed under MIT LICENSE, see LICENSE file for more info.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "GSOF_3dWireFrame"
7
- version = "1.0.0"
7
+ version = "1.1.0"
8
8
  description = "A 3D wireframe rendering library built on Pygame"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"