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
a2401f27
Commit
a2401f27
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
eod
parent
f4ef2126
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/fea/dmaCell.js
+43
-19
43 additions, 19 deletions
js/fea/dmaCell.js
js/models/lattice.js
+3
-2
3 additions, 2 deletions
js/models/lattice.js
with
46 additions
and
21 deletions
js/fea/dmaCell.js
+
43
−
19
View file @
a2401f27
...
...
@@ -19,38 +19,62 @@
cellGeometry2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
));
cellGeometry2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
0
,
30
/
Math
.
sqrt
(
3
),
octHeight
/
2
));
var
cellMaterials
=
[
new
THREE
.
MeshNormalMaterial
(),
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
wireframe
:
true
})];
var
cellMaterials
=
[
new
THREE
.
MeshNormalMaterial
(),
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
wireframe
:
true
})];
function
Cell
(
position
)
{
function
Cell
(
mode
,
position
)
{
if
(
Math
.
round
(
position
.
z
/
octHeight
)
%
2
==
0
){
this
.
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
cellGeometry1
,
cellMaterials
);
}
else
{
this
.
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
cellGeometry2
,
cellMaterials
);
}
this
.
mesh
.
position
.
x
=
position
.
x
;
this
.
mesh
.
position
.
y
=
position
.
y
;
this
.
mesh
.
position
.
z
=
position
.
z
;
this
.
mesh
.
myCell
=
this
;
//we need a reference to this instance from the mesh for
this
.
position
=
position
;
this
.
drawForMode
(
mode
,
position
);
this
.
_draw
();
// this.parts = this._createParts(nodes, config);
}
//
Cell.prototype._
create
Parts = function(
nodes, config
){
Cell
.
prototype
.
_
build
Parts
Mesh
=
function
(){
// var parts = [];
// for (var i=0;i<nodes.length;i++){
// parts.push(new Part(nodes[i], config[i]));
// }
// return parts;
//};
};
Cell
.
prototype
.
_buildCellMesh
=
function
(
position
){
//abstract mesh representation of cell
var
mesh
;
if
(
Math
.
round
(
position
.
z
/
octHeight
)
%
2
==
0
){
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
cellGeometry1
,
cellMaterials
);
}
else
{
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
cellGeometry2
,
cellMaterials
);
}
mesh
.
position
.
x
=
position
.
x
;
mesh
.
position
.
y
=
position
.
y
;
mesh
.
position
.
z
=
position
.
z
;
mesh
.
myCell
=
this
;
//we need a reference to this instance from the mesh for intersection selection stuff
return
mesh
;
};
Cell
.
prototype
.
_draw
=
function
(){
window
.
three
.
sceneAdd
(
this
.
mesh
);
};
Cell
.
prototype
.
drawForMode
=
function
(
mode
,
position
){
if
(
this
.
mesh
)
this
.
remove
();
this
.
mesh
=
null
;
position
=
position
||
this
.
position
;
if
(
mode
==
"
cell
"
){
this
.
mesh
=
this
.
_buildCellMesh
(
position
);
}
else
if
(
mode
==
"
parts
"
){
this
.
mesh
=
this
.
_buildPartsMesh
();
}
else
{
console
.
warn
(
"
unrecognized draw mode for cell
"
);
}
if
(
this
.
mesh
)
this
.
_draw
();
};
Cell
.
prototype
.
remove
=
function
(){
window
.
three
.
sceneRemove
(
this
.
mesh
);
};
...
...
This diff is collapsed.
Click to expand it.
js/models/lattice.js
+
3
−
2
View file @
a2401f27
...
...
@@ -12,7 +12,8 @@ Lattice = Backbone.Model.extend({
nodes
:
[],
cells
:
[],
numCells
:
0
,
partType
:
"
triangle
"
partType
:
"
triangle
"
,
cellMode
:
"
cell
"
},
//pass in fillGeometry
...
...
@@ -24,7 +25,7 @@ Lattice = Backbone.Model.extend({
addCell
:
function
(
position
){
var
cells
=
this
.
get
(
"
cells
"
);
cells
.
push
(
new
Cell
(
position
));
cells
.
push
(
new
Cell
(
this
.
get
(
"
cellMode
"
),
position
));
this
.
set
(
"
numCells
"
,
cells
.
length
);
window
.
three
.
render
();
},
...
...
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