Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMDesign
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
DMDesign
Commits
2e5511cb
Commit
2e5511cb
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
eod
parent
7b28f339
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
js/elementMenu.js
+8
-3
8 additions, 3 deletions
js/elementMenu.js
js/importMenu.js
+4
-0
4 additions, 0 deletions
js/importMenu.js
js/persistentWorkers.js
+1
-1
1 addition, 1 deletion
js/persistentWorkers.js
js/worker.js
+5
-3
5 additions, 3 deletions
js/worker.js
with
18 additions
and
7 deletions
js/elementMenu.js
+
8
−
3
View file @
2e5511cb
...
...
@@ -25,7 +25,9 @@ $(function(){
modelMesh
:
modelMesh
};
workers
.
map
(
xRange
,
fillWithElements
,
localEnv
,
incrCallback
);
// for (var x=boundingBox.min.x;x<boundingBox.max.x;x+=cubeDim){
// fillWithElements(x);
// }
function
incrCallback
(
result
){
console
.
log
(
result
);
...
...
@@ -49,17 +51,20 @@ $(function(){
}
function
fillWithElements
(
x
){
console
.
log
(
"
here
"
);
var
meshesToAdd
=
[];
var
cubeDim
=
localEnv
.
cubeDim
;
var
boundingBox
=
localEnv
.
boundingBox
;
var
modelClone
=
new
THREE
.
Mesh
(
localEnv
.
modelMesh
.
geometry
,
localEnv
.
modelMesh
.
material
);
//had to do this for some reason
//
var modelClone = new THREE.Mesh(localEnv.modelMesh.geometry, localEnv.modelMesh.material);//had to do this for some reason
for
(
var
y
=
boundingBox
.
min
.
y
;
y
<
boundingBox
.
max
.
y
;
y
+=
cubeDim
){
for
(
var
z
=
boundingBox
.
min
.
z
;
z
<
boundingBox
.
max
.
z
;
z
+=
cubeDim
){
var
raycaster
=
new
THREE
.
Raycaster
(
new
THREE
.
Vector3
(
x
+
cubeDim
/
2
,
y
+
cubeDim
/
2
,
z
+
cubeDim
/
2
),
new
THREE
.
Vector3
(
0
,
0
,
1
),
0
,
boundingBox
.
max
.
z
-
z
+
cubeDim
/
2
);
var
numIntersections
=
raycaster
.
intersectObject
(
model
Clone
).
length
;
var
numIntersections
=
raycaster
.
intersectObject
(
model
Mesh
).
length
;
// console.log(numIntersections);
// if (numIntersections % 2 == 1) {
// console.log("here");
// }
// var mesh = createCubeGeometry(cubeDim);
// mesh.position.set(x+cubeDim/2, y+cubeDim/2, z+cubeDim/2);
// mesh.updateMatrix();
...
...
This diff is collapsed.
Click to expand it.
js/importMenu.js
+
4
−
0
View file @
2e5511cb
...
...
@@ -7,6 +7,7 @@
$
(
function
(){
three
=
three
||
{};
workers
=
workers
||
{};
modelMesh
=
{};
var
modelScaleSlider
=
$
(
'
#stlModelScale
'
);
...
...
@@ -16,6 +17,9 @@ $(function(){
loader
.
addEventListener
(
'
load
'
,
function
(
e
)
{
var
geometry
=
e
.
content
;
resetUI
();
_
.
each
(
workers
.
allWorkers
,
function
(
worker
){
worker
.
postMessage
({
model
:
JSON
.
stringify
(
e
.
content
)});
});
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffa500
,
shading
:
THREE
.
FlatShading
,
transparent
:
true
,
opacity
:
0.5
,
side
:
THREE
.
DoubleSide
}
);
modelMesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
three
.
scene
.
add
(
modelMesh
);
...
...
This diff is collapsed.
Click to expand it.
js/persistentWorkers.js
+
1
−
1
View file @
2e5511cb
...
...
@@ -104,6 +104,6 @@ function persistentWorkers(numWorkers){
return
URL
.
createObjectURL
(
blob
);
}
return
{
map
:
map
};
//return all public methods and vars
return
{
map
:
map
,
allWorkers
:
allWorkers
};
//return all public methods and vars
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/worker.js
+
5
−
3
View file @
2e5511cb
...
...
@@ -8,6 +8,7 @@ function myWorker(){
localEnv
=
null
;
//local variables passed in from outside
working
=
false
;
//boolean that says whether I'm busy or not
arg
=
null
;
//main data we are crunching
modelMesh
=
null
;
//hold on to this so we don't have to keep passing it in
self
.
onmessage
=
function
(
e
)
{
var
data
=
e
.
data
;
...
...
@@ -23,9 +24,10 @@ function myWorker(){
// importScripts(url + 'js/element.js');
}
//
// if (data.id){
// id = data.id;
// }
if
(
data
.
model
){
var
material
=
new
THREE
.
MeshLambertMaterial
({
side
:
THREE
.
DoubleSide
});
modelMesh
=
new
THREE
.
Mesh
(
JSON
.
parse
(
data
.
model
),
material
);
}
if
(
data
.
executable
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment