GSOF-3dWireFrame 1.1.2__tar.gz → 1.1.3__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.
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Example_Drone.py +2 -2
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Example_F16.py +1 -1
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Example_dynamicWorld.py +6 -6
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Example_motionWorld.py +8 -7
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Example_staticWorld.py +1 -1
- gsof_3dwireframe-1.1.3/GSOF_3dWireFrame/Lib3D/WireFrame_display.py +60 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3/GSOF_3dWireFrame.egg-info}/PKG-INFO +1 -1
- {gsof_3dwireframe-1.1.2/GSOF_3dWireFrame.egg-info → gsof_3dwireframe-1.1.3}/PKG-INFO +1 -1
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/pyproject.toml +1 -1
- gsof_3dwireframe-1.1.2/GSOF_3dWireFrame/Lib3D/WireFrame_display.py +0 -37
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/AUTHORS +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Drone_Class.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/F16_Class.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Assembly.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Lib3D.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Object_WireFrame.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Object_base.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Objects.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Utils.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/__init__.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/stlToObj.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/MathLib/MathLib.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/MathLib/__init__.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/attitudeViewer.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/modules/AttitudeViewer_class.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/modules/Controls.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/modules/__init__.py +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/Axis.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/F16.stl +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/LandingGear.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/Plume.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/Spark.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/cube.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/cube_flex.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/frame.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/house.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/net.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/plane.stl +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/objects/pyramid.json +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame.egg-info/SOURCES.txt +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame.egg-info/dependency_links.txt +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame.egg-info/requires.txt +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame.egg-info/top_level.txt +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/LICENSE +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/README.md +0 -0
- {gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/setup.cfg +0 -0
|
@@ -105,7 +105,7 @@ if __name__ == "__main__":
|
|
|
105
105
|
|
|
106
106
|
clock = pygame.time.Clock()
|
|
107
107
|
screen = newScreen("3D Wire Frame Shapes", SCREEN_WIDTH, SCREEN_HEIGHT, Colors.WHITE)
|
|
108
|
-
wireframe = DISP.WireFrame(screen, pygame.draw.line, f=
|
|
108
|
+
wireframe = DISP.WireFrame(screen, pygame.draw.line, f=1, scale=1000.0)
|
|
109
109
|
|
|
110
110
|
fps = 30
|
|
111
111
|
maxRps = 2
|
|
@@ -137,7 +137,7 @@ if __name__ == "__main__":
|
|
|
137
137
|
camAngY_r = z*PI
|
|
138
138
|
camAngZ_r = x*PI
|
|
139
139
|
|
|
140
|
-
print(computePropellers(maxRps, camAngX_r, camAngY_r, camAngZ_r))
|
|
140
|
+
#print(computePropellers(maxRps, camAngX_r, camAngY_r, camAngZ_r))
|
|
141
141
|
A, B, C, D = computePropellers(maxRps/2, camAngX_r, camAngY_r, camAngZ_r)
|
|
142
142
|
A+=maxRps/2*sign(A)
|
|
143
143
|
B+=maxRps/2*sign(B)
|
|
@@ -81,7 +81,7 @@ if __name__ == "__main__":
|
|
|
81
81
|
pygame.init()
|
|
82
82
|
clock = pygame.time.Clock()
|
|
83
83
|
screen = newScreen("3D Wire Frame Shapes", SCREEN_WIDTH, SCREEN_HEIGHT, WHITE)
|
|
84
|
-
wireframe = DISP.WireFrame(screen, pygame.draw.line, f=
|
|
84
|
+
wireframe = DISP.WireFrame(screen, pygame.draw.line, f=0.5, scale=1000.0)
|
|
85
85
|
|
|
86
86
|
fps = 30
|
|
87
87
|
dt = 1/fps
|
|
@@ -22,13 +22,13 @@ def newScreen(title="New", resX=SCREEN_WIDTH, resY=SCREEN_HEIGHT, color=WHITE):
|
|
|
22
22
|
|
|
23
23
|
if __name__ == "__main__":
|
|
24
24
|
import json
|
|
25
|
-
d =
|
|
25
|
+
d = 30
|
|
26
26
|
solidHouse = Object(filename="./objects/house.json", color=(0,180,180), name="House").scale(10.0).setOrigin()
|
|
27
27
|
window = Object(filename="./objects/frame.json", color=(200,0,0), name="Window").setCenter(scale=0.8)
|
|
28
28
|
flexHouse = Assembly(objects = (
|
|
29
|
-
Object(filename="./objects/cube.json", color=(190,190,190), name="Body").translate(0,0,0
|
|
30
|
-
Object(filename="./objects/pyramid.json", color=(90,90,90), name="Roof").translate(0,-2.5,0
|
|
31
|
-
Assembly(objects=(window,), name="Window-Assy").translate(0,0,-1
|
|
29
|
+
Object(filename="./objects/cube.json", color=(190,190,190), name="Body").translate(0,0,0).setOrigin(),
|
|
30
|
+
Object(filename="./objects/pyramid.json", color=(90,90,90), name="Roof").translate(0,-2.5,0).setOrigin(),
|
|
31
|
+
Assembly(objects=(window,), name="Window-Assy").translate(0,0,-1).setOrigin(),
|
|
32
32
|
),
|
|
33
33
|
connections=[
|
|
34
34
|
[[0,4],[1,0]], #< Point-4 of object-0 to point-0 of object-1
|
|
@@ -41,12 +41,12 @@ if __name__ == "__main__":
|
|
|
41
41
|
|
|
42
42
|
world = Assembly(objects = (
|
|
43
43
|
solidHouse.translate(0,0,0).setOrigin(),
|
|
44
|
-
flexHouse.translate(0
|
|
44
|
+
flexHouse.translate(0,0,d).setOrigin(),
|
|
45
45
|
))
|
|
46
46
|
pygame.init()
|
|
47
47
|
clock = pygame.time.Clock()
|
|
48
48
|
screen = newScreen("3D Wire Frame Shapes", SCREEN_WIDTH, SCREEN_HEIGHT, WHITE)
|
|
49
|
-
wireframe = DISP.WireFrame(screen, pygame.draw.line,
|
|
49
|
+
wireframe = DISP.WireFrame(screen, pygame.draw.line, scale=50*80)
|
|
50
50
|
fps = 30
|
|
51
51
|
dt = 1/fps
|
|
52
52
|
t = 0.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import pygame
|
|
1
|
+
import pygame, math
|
|
2
2
|
from Lib3D.Object_WireFrame import Object_wireFrame as Object
|
|
3
3
|
from Lib3D.Assembly import Assembly
|
|
4
4
|
from Lib3D import Objects
|
|
@@ -21,16 +21,17 @@ def newScreen(title="New", resX=SCREEN_WIDTH, resY=SCREEN_HEIGHT, color=WHITE):
|
|
|
21
21
|
return screen
|
|
22
22
|
|
|
23
23
|
if __name__ == "__main__":
|
|
24
|
-
house = Object(filename="./objects/house.json", color=(0,180,180))
|
|
25
24
|
world = Assembly(objects = (
|
|
26
|
-
house,
|
|
25
|
+
Object(filename="./objects/house.json", color=(0,180,180), name="HOUSE"),
|
|
26
|
+
Object(Objects.net(20,20), color=(0,100,0), name="GROUND").scale(0.005)\
|
|
27
|
+
.rotate(x=math.pi/2, y=0, z=0).translate(-5, -1, -5).setOrigin(),
|
|
27
28
|
))
|
|
28
29
|
|
|
29
30
|
pygame.init()
|
|
30
31
|
clock = pygame.time.Clock()
|
|
31
32
|
screen = newScreen("3D Wire Frame Shapes", SCREEN_WIDTH, SCREEN_HEIGHT, WHITE)
|
|
32
|
-
wireframe = DISP.WireFrame(screen, pygame.draw.line,
|
|
33
|
-
viewer = Controls.Viewer( pos=(0,0,-
|
|
33
|
+
wireframe = DISP.WireFrame(screen, pygame.draw.line, scale=1000)
|
|
34
|
+
viewer = Controls.Viewer( pos=(0,0,-10),
|
|
34
35
|
center=(int(screen.get_width()/2), int(screen.get_height()/2)),
|
|
35
36
|
moveLeftKey = pygame.K_a,
|
|
36
37
|
moveRightKey = pygame.K_d,
|
|
@@ -54,8 +55,8 @@ if __name__ == "__main__":
|
|
|
54
55
|
|
|
55
56
|
keys = pygame.key.get_pressed()
|
|
56
57
|
(mPosX, mPosY) = pygame.mouse.get_pos()
|
|
57
|
-
wireframe.
|
|
58
|
-
viewer.update(keys, mPosX, mPosY, speed=
|
|
58
|
+
wireframe.scale += -(keys[pygame.K_1] - keys[pygame.K_2])*10
|
|
59
|
+
viewer.update(keys, mPosX, mPosY, speed=0.1)
|
|
59
60
|
|
|
60
61
|
clearScreen(screen, WHITE)
|
|
61
62
|
world.reset()
|
|
@@ -67,7 +67,7 @@ if __name__ == "__main__":
|
|
|
67
67
|
pygame.init()
|
|
68
68
|
clock = pygame.time.Clock()
|
|
69
69
|
screen = newScreen("3D Wire Frame Shapes", SCREEN_WIDTH, SCREEN_HEIGHT, WHITE)
|
|
70
|
-
wireframe = DISP.WireFrame(screen, pygame.draw.line, f=
|
|
70
|
+
wireframe = DISP.WireFrame(screen, pygame.draw.line, f=1, scale=500.0)
|
|
71
71
|
|
|
72
72
|
fps = 30
|
|
73
73
|
dt = 1/fps
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
def _findLine(x1,y1,x2,y2) -> list:
|
|
2
|
+
DX = x2 -x1
|
|
3
|
+
DY = y2 -y1
|
|
4
|
+
Ay = DY/DX
|
|
5
|
+
By = y2 -Ay*x2
|
|
6
|
+
return (Ay, By)
|
|
7
|
+
|
|
8
|
+
def calcLine(a, b, x) -> float:
|
|
9
|
+
return a*x +b
|
|
10
|
+
|
|
11
|
+
class WireFrame():
|
|
12
|
+
def __init__(self, screen, line, f=1, scale=1000.0, maxViewDistance=10000):
|
|
13
|
+
self.screen = screen #< Object to draw on
|
|
14
|
+
self.line = line #< function to draw a line
|
|
15
|
+
self.f = f #< Perspective factor
|
|
16
|
+
self.scale = scale #< Lens zoom
|
|
17
|
+
self.maxViewZ = maxViewDistance #<
|
|
18
|
+
self.minViewZ = abs(1.0) #<
|
|
19
|
+
self.centerX, self.centerY = (int(screen.get_width()/2), int(screen.get_height()/2))
|
|
20
|
+
|
|
21
|
+
def draw(self, obj, color=None) -> None:
|
|
22
|
+
""" """
|
|
23
|
+
for line in obj.getLines():
|
|
24
|
+
p1, p2 = line.points
|
|
25
|
+
#p1[2], p2[2] = -p1[2], -p2[2]
|
|
26
|
+
z0 = -self.minViewZ
|
|
27
|
+
if (p1[2] < z0) or (p2[2] < z0):
|
|
28
|
+
### At least one end of the line is infront of the camera
|
|
29
|
+
self.clip(p1,p2)
|
|
30
|
+
p1 = self.camera(p1)
|
|
31
|
+
p2 = self.camera(p2)
|
|
32
|
+
lcolor = line.color if color == None else color
|
|
33
|
+
self.drawLine( lcolor, p1, p2 )
|
|
34
|
+
|
|
35
|
+
def clip(self, p1, p2) -> None:
|
|
36
|
+
z0, z1, z2 = -self.minViewZ, p1[2], p2[2]
|
|
37
|
+
x1, x2 = p1[0], p2[0]
|
|
38
|
+
y1, y2 = p1[1], p2[1]
|
|
39
|
+
if z1 != z2:
|
|
40
|
+
Ax, Bx = _findLine(z1,x1,z2,x2)
|
|
41
|
+
Ay, By = _findLine(z1,y1,z2,y2)
|
|
42
|
+
if z1 > z0:
|
|
43
|
+
p1[0], p1[1], p1[2] = calcLine(Ax, Bx, z0), calcLine(Ay, By, z0), z0
|
|
44
|
+
elif z2 > z0:
|
|
45
|
+
p2[0], p2[1], p2[2] = calcLine(Ax, Bx, z0), calcLine(Ay, By, z0), z0
|
|
46
|
+
|
|
47
|
+
def camera(self, point) -> list:
|
|
48
|
+
""" Perspective projection <https://en.wikipedia.org/wiki/3D_projection> """
|
|
49
|
+
x, y, z = point
|
|
50
|
+
s =self.scale/10
|
|
51
|
+
z *= -1
|
|
52
|
+
if (self.f != 0):
|
|
53
|
+
s = self.scale/z
|
|
54
|
+
return (x*s, y*s, z)
|
|
55
|
+
|
|
56
|
+
def drawLine(self, color, p0, p1):
|
|
57
|
+
""" """
|
|
58
|
+
p0 = (self.centerX +p0[0], self.centerY -p0[1])
|
|
59
|
+
p1 = (self.centerX +p1[0], self.centerY -p1[1])
|
|
60
|
+
self.line( self.screen, color, p0, p1 ) #< Line from P0 to P1
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
class WireFrame():
|
|
2
|
-
def __init__(self, screen, line, f=50, scale=1.0):
|
|
3
|
-
self.screen = screen
|
|
4
|
-
self.line = line
|
|
5
|
-
self.f = f
|
|
6
|
-
self.scale = scale
|
|
7
|
-
self.centerX, self.centerY = (int(screen.get_width()/2), int(screen.get_height()/2))
|
|
8
|
-
|
|
9
|
-
def draw(self, obj, color=None) -> None:
|
|
10
|
-
""" """
|
|
11
|
-
for line in obj.getLines():
|
|
12
|
-
p0 = self.camera(line.points[0])
|
|
13
|
-
p1 = self.camera(line.points[1])
|
|
14
|
-
if (p0[2] > self.f) or (p1[2] > self.f): #Skip lines in the back of the viewer
|
|
15
|
-
lcolor = color
|
|
16
|
-
if lcolor == None:
|
|
17
|
-
lcolor = line.color
|
|
18
|
-
self.drawLine( lcolor, p0, p1 ) #< Line from P0 to P1
|
|
19
|
-
|
|
20
|
-
def camera(self, point) -> list:
|
|
21
|
-
""" Perspective projection <https://en.wikipedia.org/wiki/3D_projection> """
|
|
22
|
-
x, y, z = point
|
|
23
|
-
z = -z
|
|
24
|
-
if (self.f != None):
|
|
25
|
-
if (z > self.f):
|
|
26
|
-
s = (self.f/z)*self.scale
|
|
27
|
-
else:
|
|
28
|
-
s = 100000
|
|
29
|
-
x *= s
|
|
30
|
-
y *= s
|
|
31
|
-
return (x,y,z)
|
|
32
|
-
|
|
33
|
-
def drawLine(self, color, p0, p1):
|
|
34
|
-
""" """
|
|
35
|
-
p0 = (self.centerX +p0[0], self.centerY -p0[1])
|
|
36
|
-
p1 = (self.centerX +p1[0], self.centerY -p1[1])
|
|
37
|
-
self.line( self.screen, color, p0, p1 ) #< Line from P0 to P1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/Lib3D/Object_WireFrame.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame/modules/AttitudeViewer_class.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gsof_3dwireframe-1.1.2 → gsof_3dwireframe-1.1.3}/GSOF_3dWireFrame.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|