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
2131d4c9
Commit
2131d4c9
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
lattice scaling vis
parent
0d87bc86
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
js/menus/LatticeMenuView.js
+7
-6
7 additions, 6 deletions
js/menus/LatticeMenuView.js
js/models/BasePlane.js
+2
-2
2 additions, 2 deletions
js/models/BasePlane.js
js/models/Lattice.js
+8
-6
8 additions, 6 deletions
js/models/Lattice.js
with
17 additions
and
14 deletions
js/menus/LatticeMenuView.js
+
7
−
6
View file @
2131d4c9
...
@@ -13,7 +13,7 @@ LatticeMenuView = Backbone.View.extend({
...
@@ -13,7 +13,7 @@ LatticeMenuView = Backbone.View.extend({
"
click .cellType
"
:
"
_changeCellType
"
,
"
click .cellType
"
:
"
_changeCellType
"
,
"
click .connectionType
"
:
"
_changeConnectionType
"
,
"
click .connectionType
"
:
"
_changeConnectionType
"
,
"
slide #scaleSlider
"
:
"
_sliderDidSlide
"
,
"
slide #scaleSlider
"
:
"
_sliderDidSlide
"
,
"
slideStop #scaleSlider
"
:
"
_changeScaleSlider
"
//
"slideStop #scaleSlider": "_changeScaleSlider"
},
},
...
@@ -23,7 +23,7 @@ LatticeMenuView = Backbone.View.extend({
...
@@ -23,7 +23,7 @@ LatticeMenuView = Backbone.View.extend({
_
.
bindAll
(
this
,
"
render
"
);
_
.
bindAll
(
this
,
"
render
"
);
this
.
listenTo
(
this
.
model
,
"
change
"
,
function
(){
this
.
listenTo
(
this
.
model
,
"
change
"
,
function
(){
if
(
!
this
.
model
.
hasChanged
(
'
cellMode
'
)){
//ignore cell mode changes
if
(
!
this
.
model
.
hasChanged
(
'
cellMode
'
)
&&
!
(
this
.
model
.
hasChanged
(
'
scale
'
))
){
//ignore cell mode changes
this
.
render
();
this
.
render
();
};
};
});
});
...
@@ -44,14 +44,15 @@ LatticeMenuView = Backbone.View.extend({
...
@@ -44,14 +44,15 @@ LatticeMenuView = Backbone.View.extend({
_sliderDidSlide
:
function
(
e
){
_sliderDidSlide
:
function
(
e
){
var
scale
=
$
(
e
.
target
)[
0
].
value
;
var
scale
=
$
(
e
.
target
)[
0
].
value
;
this
.
model
.
previewScaleChange
(
scale
);
//does not trigger lattice change event - no rerendering of ui
this
.
model
.
set
(
"
scale
"
,
$
(
e
.
target
)[
0
].
value
);
// this.model.previewScaleChange(scale);//does not trigger lattice change event - no rerendering of ui
$
(
"
#latticeScale
"
).
val
(
scale
);
$
(
"
#latticeScale
"
).
val
(
scale
);
window
.
three
.
render
();
window
.
three
.
render
();
},
},
_changeScaleSlider
:
function
(
e
){
//
_changeScaleSlider: function(e){
this
.
model
.
set
(
"
scale
"
,
$
(
e
.
target
)[
0
].
value
);
//
this.model.set("scale", $(e.target)[0].value);
},
//
},
_changeCellType
:
function
(
e
){
_changeCellType
:
function
(
e
){
e
.
preventDefault
();
e
.
preventDefault
();
...
...
This diff is collapsed.
Click to expand it.
js/models/BasePlane.js
+
2
−
2
View file @
2131d4c9
...
@@ -8,8 +8,8 @@ BasePlane = Backbone.Model.extend({
...
@@ -8,8 +8,8 @@ BasePlane = Backbone.Model.extend({
defaults
:
{
defaults
:
{
zIndex
:
0
,
zIndex
:
0
,
mesh
:
null
,
mesh
:
null
,
dimX
:
10
,
dimX
:
10
0
,
dimY
:
10
,
dimY
:
10
0
,
material
:
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
transparent
:
true
,
opacity
:
0.2
,
wireframe
:
true
,
side
:
THREE
.
DoubleSide
}),
material
:
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
transparent
:
true
,
opacity
:
0.2
,
wireframe
:
true
,
side
:
THREE
.
DoubleSide
}),
currentScene
:
"
default
"
,
currentScene
:
"
default
"
,
allScenes
:
{
default
:
"
Default
"
,
"
mars
"
:
"
Mars
"
}
allScenes
:
{
default
:
"
Default
"
,
"
mars
"
:
"
Mars
"
}
...
...
This diff is collapsed.
Click to expand it.
js/models/Lattice.js
+
8
−
6
View file @
2131d4c9
...
@@ -219,9 +219,9 @@ Lattice = Backbone.Model.extend({
...
@@ -219,9 +219,9 @@ Lattice = Backbone.Model.extend({
window
.
three
.
render
();
window
.
three
.
render
();
},
},
previewScaleChange
:
function
(
scale
){
//
previewScaleChange: function(scale){
this
.
get
(
"
basePlane
"
).
updateScale
(
scale
);
//
this.get("basePlane").updateScale(scale);
},
//
},
_changeLatticeStructure
:
function
(){
_changeLatticeStructure
:
function
(){
this
.
clearCells
();
this
.
clearCells
();
...
@@ -262,7 +262,7 @@ OctaFaceLattice = Lattice.extend({
...
@@ -262,7 +262,7 @@ OctaFaceLattice = Lattice.extend({
//bind events
//bind events
this
.
listenTo
(
this
,
"
change:columnSeparation
"
,
this
.
_changeColSeparation
);
this
.
listenTo
(
this
,
"
change:columnSeparation
"
,
this
.
_changeColSeparation
);
this
.
set
(
"
columnSeparation
"
,
0.
2
);
this
.
set
(
"
columnSeparation
"
,
0.
1
);
},
},
_changeColSeparation
:
function
(){
_changeColSeparation
:
function
(){
...
@@ -279,10 +279,12 @@ OctaFaceLattice = Lattice.extend({
...
@@ -279,10 +279,12 @@ OctaFaceLattice = Lattice.extend({
//calc indices in cell matrix
//calc indices in cell matrix
var
scale
=
this
.
get
(
"
scale
"
);
var
scale
=
this
.
get
(
"
scale
"
);
var
colSep
=
this
.
get
(
"
columnSeparation
"
);
var
latticeScale
=
scale
*
(
1
+
2
*
colSep
);
var
octHeight
=
2
*
scale
/
Math
.
sqrt
(
6
);
var
octHeight
=
2
*
scale
/
Math
.
sqrt
(
6
);
var
triHeight
=
s
cale
/
2
*
Math
.
sqrt
(
3
);
var
triHeight
=
latticeS
cale
/
2
*
Math
.
sqrt
(
3
);
var
position
=
{};
var
position
=
{};
position
.
x
=
Math
.
round
(
absPosition
.
x
/
s
cale
);
position
.
x
=
Math
.
round
(
absPosition
.
x
/
latticeS
cale
);
position
.
y
=
Math
.
round
(
absPosition
.
y
/
triHeight
);
position
.
y
=
Math
.
round
(
absPosition
.
y
/
triHeight
);
position
.
z
=
Math
.
round
(
absPosition
.
z
/
octHeight
);
position
.
z
=
Math
.
round
(
absPosition
.
z
/
octHeight
);
if
(
position
.
z
%
2
==
1
)
position
.
y
+=
1
;
if
(
position
.
z
%
2
==
1
)
position
.
y
+=
1
;
...
...
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