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
0469a338
Commit
0469a338
authored
9 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
rotation working again
parent
45b53205
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/cam/assemblers/Assembler.js
+4
-6
4 additions, 6 deletions
js/cam/assemblers/Assembler.js
js/cam/assemblers/Component.js
+9
-16
9 additions, 16 deletions
js/cam/assemblers/Component.js
with
13 additions
and
22 deletions
js/cam/assemblers/Assembler.js
+
4
−
6
View file @
0469a338
...
@@ -224,15 +224,13 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
...
@@ -224,15 +224,13 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
};
};
Assembler
.
prototype
.
pickUpStock
=
function
(
index
,
position
,
speed
,
settings
,
callback
){
Assembler
.
prototype
.
pickUpStock
=
function
(
index
,
position
,
speed
,
settings
,
callback
){
if
(
index
.
z
%
2
!=
0
)
{
//rotate on odd rows
this
.
components
.
frame
.
rotateTo
(
new
THREE
.
Vector3
(
0
,
0
,
Math
.
PI
/
2
),
speed
,
callback
);
}
else
{
this
.
components
.
frame
.
rotateTo
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
speed
,
callback
);
}
_
.
each
(
this
.
stock
,
function
(
stock
){
_
.
each
(
this
.
stock
,
function
(
stock
){
stock
.
show
();
stock
.
show
();
});
});
callback
();
if
(
index
.
z
%
2
!=
0
)
{
//rotate on odd rows
this
.
components
.
frame
.
rotateTo
(
new
THREE
.
Vector3
(
0
,
0
,
Math
.
PI
/
2
),
speed
,
callback
);
}
this
.
components
.
frame
.
rotateTo
(
new
THREE
.
Vector3
(
0
,
0
,
0
),
speed
,
callback
);
};
};
Assembler
.
prototype
.
releaseStock
=
function
(
index
,
position
,
settings
){
Assembler
.
prototype
.
releaseStock
=
function
(
index
,
position
,
settings
){
...
...
This diff is collapsed.
Click to expand it.
js/cam/assemblers/Component.js
+
9
−
16
View file @
0469a338
...
@@ -74,7 +74,7 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
...
@@ -74,7 +74,7 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
};
};
Component
.
prototype
.
getRotation
=
function
(){
Component
.
prototype
.
getRotation
=
function
(){
return
this
.
object3D
.
rotation
.
toVector3
();
return
this
.
object3D
.
rotation
.
toVector3
()
.
clone
()
;
};
};
Component
.
prototype
.
getObject3D
=
function
(){
Component
.
prototype
.
getObject3D
=
function
(){
...
@@ -88,41 +88,34 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
...
@@ -88,41 +88,34 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
}
}
var
currentPosition
=
this
.
getRotation
();
var
currentPosition
=
this
.
getRotation
();
var
increment
=
0.15
;
//speed/1500.0*cam.get("simSpeed");
var
increment
=
0.15
;
//speed/1500.0*cam.get("simSpeed");
var
incr
Vector
=
target
.
clone
().
sub
(
currentPosition
);
var
axis
=
new
THREE
.
Vector3
().
sub
Vector
s
(
target
,
currentPosition
);
if
(
increment
==
0
||
incrVector
.
length
()
==
0
)
{
if
(
increment
==
0
||
axis
.
length
()
==
0
)
{
if
(
callback
)
callback
();
if
(
callback
)
callback
();
return
;
return
;
}
}
increment
=
Math
.
max
(
increment
,
0.00001
);
//need to put a min on the increment - otherwise this stalls out with floating pt tol
increment
=
Math
.
max
(
increment
,
0.00001
);
//need to put a min on the increment - otherwise this stalls out with floating pt tol
incrVector
.
normalize
().
multiplyScalar
(
increment
);
this
.
_incrementalRotation
(
increment
,
target
,
axis
,
callback
);
this
.
_incrementalRotation
(
incrVector
,
target
,
callback
);
};
};
Component
.
prototype
.
_incrementalRotation
=
function
(
increment
,
target
,
callback
){
Component
.
prototype
.
_incrementalRotation
=
function
(
increment
,
target
,
axis
,
callback
){
var
self
=
this
;
var
self
=
this
;
setTimeout
(
function
(){
setTimeout
(
function
(){
var
remainingDist
=
(
target
.
clone
().
sub
(
self
.
getRotation
())).
length
();
var
remainingDist
=
(
target
.
clone
().
sub
(
self
.
getRotation
())).
length
();
var
nextPos
;
if
(
remainingDist
<
0.01
)
{
if
(
remainingDist
==
0
)
{
if
(
callback
)
callback
();
if
(
callback
)
callback
();
return
;
return
;
}
else
if
(
remainingDist
<
increment
.
length
()){
}
else
if
(
remainingDist
<
Math
.
abs
(
increment
)){
nextPos
=
target
;
//don't overshoot
self
.
object3D
.
rotation
.
x
=
target
.
x
;
self
.
object3D
.
rotation
.
x
=
target
.
x
;
self
.
object3D
.
rotation
.
y
=
target
.
y
;
self
.
object3D
.
rotation
.
y
=
target
.
y
;
self
.
object3D
.
rotation
.
z
=
target
.
z
;
self
.
object3D
.
rotation
.
z
=
target
.
z
;
if
(
callback
)
callback
();
if
(
callback
)
callback
();
return
;
return
;
}
else
{
nextPos
=
self
.
getRotation
().
add
(
increment
);
}
}
// console.log(target.clone().normalize());
self
.
object3D
.
rotateOnAxis
(
axis
.
clone
().
normalize
(),
increment
);
console
.
log
(
increment
);
self
.
_incrementalRotation
(
increment
,
target
,
axis
,
callback
);
self
.
object3D
.
rotateOnAxis
(
target
.
clone
().
normalize
(),
nextPos
.
z
);
self
.
_incrementalRotation
(
increment
,
target
,
callback
);
},
10
);
},
10
);
};
};
...
...
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