Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pyMKcam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
pyMKcam
Commits
a87a94d4
Commit
a87a94d4
authored
Mar 24, 2012
by
Whitham D. Reeve II
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old commented out code.
parent
d46107ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
9 deletions
+0
-9
OpenGLViewModel.py
pycam/Plugins/OpenGLViewModel.py
+0
-5
OpenGLWindow.py
pycam/Plugins/OpenGLWindow.py
+0
-4
No files found.
pycam/Plugins/OpenGLViewModel.py
View file @
a87a94d4
...
@@ -148,26 +148,21 @@ class OpenGLViewModelTriangle(pycam.Plugins.PluginBase):
...
@@ -148,26 +148,21 @@ class OpenGLViewModelTriangle(pycam.Plugins.PluginBase):
suitable
=
(
0
,
0
,
0
,
'v'
)
suitable
=
(
0
,
0
,
0
,
'v'
)
for
normal
,
weight
in
normals
:
for
normal
,
weight
in
normals
:
dot
=
pdot
(
main
,
normal
)
dot
=
pdot
(
main
,
normal
)
#dot = main.dot(normal)
if
dot
>
0
:
if
dot
>
0
:
suitable
=
padd
(
suitable
,
pmul
(
normal
,
weight
*
dot
))
suitable
=
padd
(
suitable
,
pmul
(
normal
,
weight
*
dot
))
#suitable = suitable.add(normal.mul(weight * dot))
return
pnormalized
(
suitable
)
return
pnormalized
(
suitable
)
#return suitable.normalized()
vertices
=
{}
vertices
=
{}
for
t
in
model
.
triangles
():
for
t
in
model
.
triangles
():
for
p
in
(
t
.
p1
,
t
.
p2
,
t
.
p3
):
for
p
in
(
t
.
p1
,
t
.
p2
,
t
.
p3
):
if
not
p
in
vertices
:
if
not
p
in
vertices
:
vertices
[
p
]
=
[]
vertices
[
p
]
=
[]
vertices
[
p
]
.
append
((
pnormalized
(
t
.
normal
),
t
.
get_area
()))
vertices
[
p
]
.
append
((
pnormalized
(
t
.
normal
),
t
.
get_area
()))
#vertices[p].append((t.normal.normalized(), t.get_area()))
GL
.
glBegin
(
GL
.
GL_TRIANGLES
)
GL
.
glBegin
(
GL
.
GL_TRIANGLES
)
for
t
in
model
.
triangles
():
for
t
in
model
.
triangles
():
# The triangle's points are in clockwise order, but GL expects
# The triangle's points are in clockwise order, but GL expects
# counter-clockwise sorting.
# counter-clockwise sorting.
for
p
in
(
t
.
p1
,
t
.
p3
,
t
.
p2
):
for
p
in
(
t
.
p1
,
t
.
p3
,
t
.
p2
):
normal
=
calc_normal
(
pnormalized
(
t
.
normal
),
vertices
[
p
])
normal
=
calc_normal
(
pnormalized
(
t
.
normal
),
vertices
[
p
])
#normal = calc_normal(t.normal.normalized(), vertices[coords])
GL
.
glNormal3f
(
normal
[
0
],
normal
[
1
],
normal
[
2
])
GL
.
glNormal3f
(
normal
[
0
],
normal
[
1
],
normal
[
2
])
GL
.
glVertex3f
(
p
[
0
],
p
[
1
],
p
[
2
])
GL
.
glVertex3f
(
p
[
0
],
p
[
1
],
p
[
2
])
GL
.
glEnd
()
GL
.
glEnd
()
...
...
pycam/Plugins/OpenGLWindow.py
View file @
a87a94d4
...
@@ -816,11 +816,9 @@ class Camera(object):
...
@@ -816,11 +816,9 @@ class Camera(object):
return
return
max_dim
=
max
([
high
-
low
for
low
,
high
in
low_high
])
max_dim
=
max
([
high
-
low
for
low
,
high
in
low_high
])
distv
=
pnormalized
((
v
[
"distance"
][
0
],
v
[
"distance"
][
1
],
v
[
"distance"
][
2
]))
distv
=
pnormalized
((
v
[
"distance"
][
0
],
v
[
"distance"
][
1
],
v
[
"distance"
][
2
]))
#distv = Point(v["distance"][0], v["distance"][1],v["distance"][2]).normalized()
# The multiplier "1.25" is based on experiments. 1.414 (sqrt(2)) should
# The multiplier "1.25" is based on experiments. 1.414 (sqrt(2)) should
# be roughly sufficient for showing the diagonal of any model.
# be roughly sufficient for showing the diagonal of any model.
distv
=
pmul
(
distv
,
(
max_dim
*
1.25
)
/
number
(
math
.
sin
(
v
[
"fovy"
]
/
2
)))
distv
=
pmul
(
distv
,
(
max_dim
*
1.25
)
/
number
(
math
.
sin
(
v
[
"fovy"
]
/
2
)))
#distv = distv.mul((max_dim * 1.25) / number(math.sin(v["fovy"] / 2)))
self
.
view
[
"distance"
]
=
distv
self
.
view
[
"distance"
]
=
distv
# Adjust the "far" distance for the camera to make sure, that huge
# Adjust the "far" distance for the camera to make sure, that huge
# models (e.g. x=1000) are still visible.
# models (e.g. x=1000) are still visible.
...
@@ -979,8 +977,6 @@ class Camera(object):
...
@@ -979,8 +977,6 @@ class Camera(object):
distv
=
self
.
view
[
"distance"
]
distv
=
self
.
view
[
"distance"
]
distv
=
pnormalized
((
distv
[
0
],
distv
[
1
],
distv
[
2
]))
distv
=
pnormalized
((
distv
[
0
],
distv
[
1
],
distv
[
2
]))
factors_x
=
pnormalized
(
pcross
(
distv
,
(
v_up
[
0
],
v_up
[
1
],
v_up
[
2
])))
factors_x
=
pnormalized
(
pcross
(
distv
,
(
v_up
[
0
],
v_up
[
1
],
v_up
[
2
])))
#factors_x = distv.cross(Point(v_up[0], v_up[1], v_up[2])).normalized()
#factors_x = (factors_x.x, factors_x.y, factors_x.z)
return
(
factors_x
,
factors_y
)
return
(
factors_x
,
factors_y
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment