Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
0c709aeb
Commit
0c709aeb
authored
Aug 18, 2015
by
Amanda Ghassaei
Browse files
gik lattice reorientation, and axes
parent
942cac95
Changes
9
Hide whitespace changes
Inline
Side-by-side
assets/imgs/axes.png
0 → 100644
View file @
0c709aeb
8.74 KB
js/cam/assemblers/Assembler.js
View file @
0c709aeb
...
...
@@ -72,7 +72,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
if
(
json
.
scale
)
geometry
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeScale
(
json
.
scale
,
json
.
scale
,
json
.
scale
));
geometry
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
-
21
,
-
0.63
,
0
));
//todo get rid of these
geometry
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
/
2
));
//
geometry.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/2));
return
geometry
;
}
...
...
@@ -339,10 +339,10 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
if
(
totalThreads
>
0
)
return
;
callback
();
}
var
startingPos
=
{
x
:
this
.
components
.
y
Axis
.
getPosition
().
x
,
y
:
this
.
components
.
x
Axis
.
getPosition
().
y
,
z
:
this
.
components
.
zAxis
.
getPosition
().
z
};
var
startingPos
=
{
x
:
this
.
components
.
x
Axis
.
getPosition
().
x
,
y
:
this
.
components
.
y
Axis
.
getPosition
().
y
,
z
:
this
.
components
.
zAxis
.
getPosition
().
z
};
speed
=
this
.
_normalizeSpeed
(
startingPos
,
position
,
new
THREE
.
Vector3
(
speed
,
speed
,
speed
));
this
.
components
.
y
Axis
.
moveTo
(
this
.
_makeAxisVector
(
position
,
"
x
"
),
speed
.
x
,
sketchyCallback
);
this
.
components
.
x
Axis
.
moveTo
(
this
.
_makeAxisVector
(
position
,
"
y
"
),
speed
.
y
,
sketchyCallback
);
this
.
components
.
x
Axis
.
moveTo
(
this
.
_makeAxisVector
(
position
,
"
x
"
),
speed
.
x
,
sketchyCallback
);
this
.
components
.
y
Axis
.
moveTo
(
this
.
_makeAxisVector
(
position
,
"
y
"
),
speed
.
y
,
sketchyCallback
);
this
.
components
.
zAxis
.
moveTo
(
this
.
_makeAxisVector
(
position
,
"
z
"
),
speed
.
z
,
sketchyCallback
);
};
...
...
js/lattice/latticeSubclasses/GIKLattice.js
View file @
0c709aeb
...
...
@@ -44,12 +44,12 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
},
_zIndexRotation
:
function
(
index
){
if
(
index
.
z
%
2
=
=
0
)
return
Math
.
PI
/
2
;
if
(
index
.
z
%
2
!
=
0
)
return
Math
.
PI
/
2
;
return
0
;
},
_zIndexRotationSuperCell
:
function
(
index
){
if
(
index
.
z
%
2
!=
0
)
return
-
Math
.
PI
/
2
;
//this
never changes
if
(
index
.
z
%
2
!=
0
)
return
Math
.
PI
/
2
;
//this
goes neg if zIndexRotation rules are opp? need to clear this up eventually
return
0
;
},
...
...
js/main.js
View file @
0c709aeb
...
...
@@ -22,6 +22,7 @@ require.config({
threeModel
:
'
three/ThreeModel
'
,
threeView
:
'
three/ThreeView
'
,
fillGeometry
:
'
three/FillGeometry
'
,
axes
:
'
three/Axes
'
,
//plist
plist
:
'
plists/PList
'
,
...
...
js/menus/Ribbon.js
View file @
0c709aeb
...
...
@@ -12,7 +12,8 @@ define(['jquery', 'underscore', 'backbone', 'plist', 'lattice', 'appState', 'tex
"
click .ribbonCellMode
"
:
"
_updateCellMode
"
,
"
click .ribbonDeleteMode
"
:
"
_updateDeleteMode
"
,
"
click .highlightMode
"
:
"
_updateHighlightMode
"
,
"
click .cellsVisible
"
:
"
_updateCellVisibility
"
"
click .cellsVisible
"
:
"
_updateCellVisibility
"
,
"
click #ribbonAxesToggle
"
:
"
_setAxesVis
"
},
initialize
:
function
(){
...
...
@@ -25,6 +26,7 @@ define(['jquery', 'underscore', 'backbone', 'plist', 'lattice', 'appState', 'tex
this
.
listenTo
(
this
.
model
,
"
change:deleteMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:highlightMode
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:cellsVisible
"
,
this
.
render
);
this
.
listenTo
(
this
.
model
,
"
change:axesAreVisible
"
,
this
.
render
);
this
.
listenTo
(
lattice
,
"
change:cellType change:connectionType
"
,
this
.
render
);
this
.
render
();
},
...
...
@@ -55,6 +57,11 @@ define(['jquery', 'underscore', 'backbone', 'plist', 'lattice', 'appState', 'tex
else
this
.
$el
.
hide
();
},
_setAxesVis
:
function
(
e
){
e
.
preventDefault
();
this
.
model
.
set
(
"
axesAreVisible
"
,
!
this
.
model
.
get
(
"
axesAreVisible
"
));
},
render
:
function
(){
this
.
$el
.
html
(
this
.
template
(
_
.
extend
(
lattice
.
toJSON
(),
this
.
model
.
toJSON
(),
plist
)));
},
...
...
js/menus/templates/Ribbon.html
View file @
0c709aeb
...
...
@@ -10,6 +10,7 @@
<
%
if
(
currentNav
!=
"
electronicNavSim
"
&&
currentNav
!=
"
mechanicalNavSim
"
&&
currentNav
!=
"
navAssemble
"
&&
currentNav
!=
"
navOptimize
"){%
>
<a
class=
"btn btn-primary btn-ribbon ribbonDeleteMode<% if (deleteMode){ %> ribbon-selected"
<%
}
%
>
">
<span
class=
"fui-cross"
></span></a>
<
%
}
%
>
<a
id=
"ribbonAxesToggle"
class=
"btn btn-primary btn-ribbon <% if (axesAreVisible){ %> ribbon-selected"
<%
}
%
>
">Axes
</a>
</div>
</div>
<!--//<a class="btn btn-primary btn-ribbon highlightMode<% if (highlightMode){ %> ribbon-selected<% } %>" href="#"><img data-type="part" src="assets/imgs/cursor-light.png"></a>-->
...
...
js/models/AppState.js
View file @
0c709aeb
...
...
@@ -62,6 +62,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
this
.
listenTo
(
this
,
"
change:materialType
"
,
this
.
_materialTypeChanged
);
this
.
listenTo
(
this
,
"
change:gikLength
"
,
this
.
_gikLengthChanged
);
this
.
listenTo
(
this
,
"
change:turnOffRendering
"
,
this
.
_renderingOnOff
);
this
.
listenTo
(
this
,
"
change:axesAreVisible
"
,
this
.
_showAxes
);
this
.
downKeys
=
{};
//track keypresses to prevent repeat keystrokes on hold
this
.
lastCellMode
=
this
.
get
(
"
cellMode
"
);
//store this to toggle on/off hide mode
...
...
@@ -149,6 +150,14 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
if
(
!
this
.
get
(
"
turnOffRendering
"
))
three
.
render
();
},
_showAxes
:
function
(){
var
visible
=
this
.
get
(
"
axesAreVisible
"
);
require
([
'
axes
'
],
function
(
axes
){
axes
.
setVisibility
(
visible
);
three
.
render
();
})
},
///////////////////////////////////////////////////////////////////////////////
/////////////////////KEY BINDINGS//////////////////////////////////////////////
...
...
js/plists/CamPList.js
View file @
0c709aeb
...
...
@@ -111,8 +111,7 @@ define(['three'], function(THREE){
},
name
:
"
Stock 1
"
,
parent
:
"
zAxis
"
,
position
:
{
x
:
0
,
y
:
0
,
z
:
0
},
rotation
:
{
x
:
0
,
y
:
0
,
z
:
Math
.
PI
/
2
}
position
:
{
x
:
0
,
y
:
0
,
z
:
0
}
},
stock2
:
{
description
:{
...
...
@@ -121,8 +120,7 @@ define(['three'], function(THREE){
},
name
:
"
Stock 2
"
,
parent
:
"
zAxis
"
,
position
:
{
x
:
0.236
,
y
:
26
,
z
:
0
},
rotation
:
{
x
:
0
,
y
:
0
,
z
:
Math
.
PI
/
2
}
position
:
{
x
:
26
,
y
:
0.236
,
z
:
0
}
}
},
lattice
:{
...
...
js/three/Axes.js
0 → 100644
View file @
0c709aeb
/**
* Created by aghassaei on 8/18/15.
*/
define
([
'
three
'
,
'
threeModel
'
],
function
(
THREE
,
three
){
var
radius
=
0.5
;
var
height
=
20
;
var
arrowGeometry
=
new
THREE
.
CylinderGeometry
(
0
,
2
*
radius
,
height
/
5
);
var
axisGeometry
=
new
THREE
.
CylinderGeometry
(
radius
,
radius
,
height
);
var
xAxisMaterial
=
new
THREE
.
MeshBasicMaterial
({
color
:
0xFF0000
});
var
xAxisMesh
=
new
THREE
.
Mesh
(
axisGeometry
,
xAxisMaterial
);
var
xArrowMesh
=
new
THREE
.
Mesh
(
arrowGeometry
,
xAxisMaterial
);
xAxisMesh
.
add
(
xArrowMesh
);
xArrowMesh
.
position
.
y
+=
height
/
2
;
xAxisMesh
.
rotation
.
z
-=
90
*
Math
.
PI
/
180
;
xAxisMesh
.
position
.
x
+=
height
/
2
;
var
yAxisMaterial
=
new
THREE
.
MeshBasicMaterial
({
color
:
0x00FF00
});
var
yAxisMesh
=
new
THREE
.
Mesh
(
axisGeometry
,
yAxisMaterial
);
var
yArrowMesh
=
new
THREE
.
Mesh
(
arrowGeometry
,
yAxisMaterial
);
yAxisMesh
.
add
(
yArrowMesh
);
yArrowMesh
.
position
.
y
+=
height
/
2
;
yAxisMesh
.
position
.
y
+=
height
/
2
;
var
zAxisMaterial
=
new
THREE
.
MeshBasicMaterial
({
color
:
0x0000FF
});
var
zAxisMesh
=
new
THREE
.
Mesh
(
axisGeometry
,
zAxisMaterial
);
var
zArrowMesh
=
new
THREE
.
Mesh
(
arrowGeometry
,
zAxisMaterial
);
zAxisMesh
.
add
(
zArrowMesh
);
zAxisMesh
.
rotation
.
x
+=
90
*
Math
.
PI
/
180
;
zArrowMesh
.
position
.
y
+=
height
/
2
;
zAxisMesh
.
position
.
z
+=
height
/
2
;
var
axesMesh
=
new
THREE
.
Object3D
();
axesMesh
.
add
(
xAxisMesh
);
axesMesh
.
add
(
yAxisMesh
);
axesMesh
.
add
(
zAxisMesh
);
three
.
sceneAdd
(
axesMesh
);
setVisibility
(
false
);
function
setVisibility
(
visible
){
axesMesh
.
visible
=
visible
;
}
return
{
setVisibility
:
setVisibility
}
});
\ No newline at end of file
Write
Preview
Supports
Markdown
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