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
025ae5b0
Commit
025ae5b0
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
eod
parent
9abb52d3
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/PartMenuView.js
+5
-1
5 additions, 1 deletion
js/menus/PartMenuView.js
js/models/BasePlane.js
+34
-8
34 additions, 8 deletions
js/models/BasePlane.js
js/models/Lattice.js
+20
-0
20 additions, 0 deletions
js/models/Lattice.js
with
59 additions
and
9 deletions
js/menus/PartMenuView.js
+
5
−
1
View file @
025ae5b0
...
@@ -7,6 +7,7 @@ PartMenuView = Backbone.View.extend({
...
@@ -7,6 +7,7 @@ PartMenuView = Backbone.View.extend({
el
:
"
#menuContent
"
,
el
:
"
#menuContent
"
,
events
:
{
events
:
{
"
slide #columnSepSlider
"
:
"
_changeColSeparation
"
},
},
initialize
:
function
(
options
){
initialize
:
function
(
options
){
...
@@ -18,6 +19,10 @@ PartMenuView = Backbone.View.extend({
...
@@ -18,6 +19,10 @@ PartMenuView = Backbone.View.extend({
},
},
_changeColSeparation
:
function
(
e
){
this
.
model
.
set
(
"
columnSeparation
"
,
$
(
e
.
target
).
val
());
},
render
:
function
(){
render
:
function
(){
if
(
this
.
appState
.
get
(
"
currentTab
"
)
!=
"
part
"
)
return
;
if
(
this
.
appState
.
get
(
"
currentTab
"
)
!=
"
part
"
)
return
;
this
.
$el
.
html
(
this
.
template
(
this
.
model
.
attributes
));
this
.
$el
.
html
(
this
.
template
(
this
.
model
.
attributes
));
...
@@ -40,7 +45,6 @@ PartMenuView = Backbone.View.extend({
...
@@ -40,7 +45,6 @@ PartMenuView = Backbone.View.extend({
</ul>
\
</ul>
\
</div><br/><br/>
\
</div><br/><br/>
\
Column Separation: <input id="columnSepSlider" data-slider-id="ex1Slider" type="text" data-slider-min="0" data-slider-max="50" data-slider-step="0.1" data-slider-value="<%= scale %>"/>
\
Column Separation: <input id="columnSepSlider" data-slider-id="ex1Slider" type="text" data-slider-min="0" data-slider-max="50" data-slider-step="0.1" data-slider-value="<%= scale %>"/>
\
<br/><input id="columnSep" value="<%= scale %>" placeholder="enter scale" class="form-control" type="text"><br/>
\
<br/>
\
'
)
'
)
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/models/BasePlane.js
+
34
−
8
View file @
025ae5b0
...
@@ -28,6 +28,12 @@ BasePlane = Backbone.Model.extend({
...
@@ -28,6 +28,12 @@ BasePlane = Backbone.Model.extend({
},
},
updateColSeparation
:
function
(
colSep
){
var
geometry
=
this
.
get
(
"
mesh
"
).
geometry
;
geometry
.
vertices
=
this
.
_calcOctaFaceVertices
();
geometry
.
verticesNeedUpdate
=
true
;
},
_renderZIndexChange
:
function
(){
_renderZIndexChange
:
function
(){
var
zIndex
=
this
.
get
(
"
zIndex
"
);
var
zIndex
=
this
.
get
(
"
zIndex
"
);
var
scale
=
this
.
get
(
"
mesh
"
).
scale
.
z
;
var
scale
=
this
.
get
(
"
mesh
"
).
scale
.
z
;
...
@@ -66,24 +72,20 @@ BasePlane = Backbone.Model.extend({
...
@@ -66,24 +72,20 @@ BasePlane = Backbone.Model.extend({
_createOctaFaceMesh
:
function
(){
_createOctaFaceMesh
:
function
(){
var
geometry
=
new
THREE
.
Geometry
();
var
geometry
=
new
THREE
.
Geometry
();
var
vertices
=
geometry
.
vertices
;
geometry
.
dynamic
=
true
;
geometry
.
vertices
=
this
.
_calcOctaFaceVertices
();
var
faces
=
geometry
.
faces
;
var
faces
=
geometry
.
faces
;
var
triangleHeight
=
1
/
2
*
Math
.
sqrt
(
3
);
var
dimX
=
this
.
get
(
"
dimX
"
);
var
dimX
=
this
.
get
(
"
dimX
"
);
var
dimY
=
this
.
get
(
"
dimY
"
);
var
dimY
=
this
.
get
(
"
dimY
"
);
var
currentOffset
=
0
;
for
(
var
j
=-
dimX
;
j
<=
dimX
;
j
++
){
for
(
var
j
=-
dimX
;
j
<=
dimX
;
j
++
){
for
(
var
i
=-
dimY
;
i
<=
dimY
;
i
++
){
for
(
var
i
=-
dimY
;
i
<=
dimY
;
i
++
){
var
xOffset
=
0
;
currentOffset
++
;
if
(
Math
.
abs
(
j
)
%
2
==
1
)
xOffset
=
1
/
2
;
vertices
.
push
(
new
THREE
.
Vector3
(
i
+
xOffset
,
j
*
triangleHeight
,
0
));
if
(
j
==
-
dimX
||
i
==
-
dimY
)
continue
;
if
(
j
==
-
dimX
||
i
==
-
dimY
)
continue
;
var
currentOffset
=
vertices
.
length
;
if
(
Math
.
abs
(
j
)
%
2
==
1
){
if
(
Math
.
abs
(
j
)
%
2
==
1
){
// faces.push(new THREE.Face3(currentOffset-1, currentOffset-2, currentOffset-2-2*baseDim));
// faces.push(new THREE.Face3(currentOffset-1, currentOffset-2, currentOffset-2-2*baseDim));
faces
.
push
(
new
THREE
.
Face3
(
currentOffset
-
2
,
currentOffset
-
3
-
2
*
dimX
,
currentOffset
-
2
-
2
*
dimY
));
faces
.
push
(
new
THREE
.
Face3
(
currentOffset
-
2
,
currentOffset
-
3
-
2
*
dimX
,
currentOffset
-
2
-
2
*
dimY
));
...
@@ -95,10 +97,34 @@ BasePlane = Backbone.Model.extend({
...
@@ -95,10 +97,34 @@ BasePlane = Backbone.Model.extend({
}
}
}
}
geometry
.
computeFaceNormals
();
geometry
.
computeFaceNormals
();
return
new
THREE
.
Mesh
(
geometry
,
this
.
get
(
"
material
"
));
return
new
THREE
.
Mesh
(
geometry
,
this
.
get
(
"
material
"
));
},
},
_calcOctaFaceVertices
:
function
(
colSep
){
var
vertices
=
[];
var
triangleHeight
=
1
/
2
*
Math
.
sqrt
(
3
);
var
dimX
=
this
.
get
(
"
dimX
"
);
var
dimY
=
this
.
get
(
"
dimY
"
);
// var pointVertOffset = triangleHeight*colSep;
// var baseVertOffset =
for
(
var
j
=-
dimX
;
j
<=
dimX
;
j
++
){
for
(
var
i
=-
dimY
;
i
<=
dimY
;
i
++
){
var
xOffset
=
0
;
if
(
Math
.
abs
(
j
)
%
2
==
1
)
xOffset
=
1
/
2
;
vertices
.
push
(
new
THREE
.
Vector3
(
i
+
xOffset
,
j
*
triangleHeight
,
0
));
}
}
return
vertices
;
},
_createGridMesh
:
function
(){
_createGridMesh
:
function
(){
return
this
.
_createOctaFaceMesh
();
return
this
.
_createOctaFaceMesh
();
},
},
...
...
This diff is collapsed.
Click to expand it.
js/models/Lattice.js
+
20
−
0
View file @
025ae5b0
...
@@ -47,6 +47,8 @@ Lattice = Backbone.Model.extend({
...
@@ -47,6 +47,8 @@ Lattice = Backbone.Model.extend({
this
.
set
(
"
basePlane
"
,
new
BasePlane
({
cellType
:
this
.
get
(
"
cellType
"
),
this
.
set
(
"
basePlane
"
,
new
BasePlane
({
cellType
:
this
.
get
(
"
cellType
"
),
connectionType
:
this
.
get
(
"
connectionType
"
),
connectionType
:
this
.
get
(
"
connectionType
"
),
scale
:
this
.
get
(
"
scale
"
)}));
scale
:
this
.
get
(
"
scale
"
)}));
this
.
_initialize
();
//call subclass init
},
},
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
...
@@ -251,6 +253,24 @@ Lattice = Backbone.Model.extend({
...
@@ -251,6 +253,24 @@ Lattice = Backbone.Model.extend({
OctaFaceLattice
=
Lattice
.
extend
({
OctaFaceLattice
=
Lattice
.
extend
({
// defaults: {
// columnSeparation: 0.2//% column separation
// },
_initialize
:
function
(){
this
.
set
(
"
columnSeparation
"
,
0.2
);
//bind events
this
.
listenTo
(
this
,
"
change:columnSeparation
"
,
this
.
_changeColSeparation
);
},
_changeColSeparation
:
function
(){
var
colSep
=
this
.
get
(
"
columnSeparation
"
);
console
.
log
(
colSep
);
this
.
get
(
"
basePlane
"
).
updateColSeparation
(
colSep
);
},
addCellAtPosition
:
function
(
absPosition
){
addCellAtPosition
:
function
(
absPosition
){
//calc indices in cell matrix
//calc indices in cell matrix
...
...
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