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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
DMDesign
Commits
e1fb1a5b
Commit
e1fb1a5b
authored
Jan 28, 2015
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
pulled scale hard coded into cell class
parent
53b93cd0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/fea/dmaCell.js
+23
-13
23 additions, 13 deletions
js/fea/dmaCell.js
js/models/lattice.js
+1
-1
1 addition, 1 deletion
js/models/lattice.js
with
24 additions
and
14 deletions
js/fea/dmaCell.js
+
23
−
13
View file @
e1fb1a5b
...
...
@@ -7,30 +7,39 @@
(
function
()
{
var
o
ctHeight
=
2
*
30
/
Math
.
sqrt
(
6
);
var
unitO
ctHeight
=
2
/
Math
.
sqrt
(
6
);
var
c
ellGeo
metry
1
=
new
THREE
.
OctahedronGeometry
(
30
/
Math
.
sqrt
(
2
));
c
ellGeo
metry
1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
-
3
*
Math
.
PI
/
12
));
c
ellGeo
metry
1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationX
(
Math
.
asin
(
2
/
Math
.
sqrt
(
2
)
/
Math
.
sqrt
(
3
))));
var
unitC
ellGeo1
=
new
THREE
.
OctahedronGeometry
(
1
/
Math
.
sqrt
(
2
));
unitC
ellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
-
3
*
Math
.
PI
/
12
));
unitC
ellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationX
(
Math
.
asin
(
2
/
Math
.
sqrt
(
2
)
/
Math
.
sqrt
(
3
))));
var
c
ellGeo
metry2
=
c
ellGeo
metry
1
.
clone
();
var
unitC
ellGeo
2
=
unitC
ellGeo1
.
clone
();
c
ellGeo
metry
1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
0
,
-
30
/
Math
.
sqrt
(
3
),
o
ctHeight
/
2
));
c
ellGeo
metry
2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
));
c
ellGeo
metry
2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
0
,
30
/
Math
.
sqrt
(
3
),
o
ctHeight
/
2
));
unitC
ellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
0
,
-
1
/
Math
.
sqrt
(
3
),
unitO
ctHeight
/
2
));
unitC
ellGeo2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
));
unitC
ellGeo2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
0
,
1
/
Math
.
sqrt
(
3
),
unitO
ctHeight
/
2
));
var
cellMaterials
=
[
new
THREE
.
MeshNormalMaterial
(),
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
wireframe
:
true
})];
var
cellGeometry1
;
var
cellGeometry2
;
function
DMACell
(
mode
,
indices
)
{
setScale
(
30
);
this
.
indices
=
indices
;
this
.
position
=
this
.
_calcPositionForScale
(
30
);
function
setScale
(
scale
){
cellGeometry1
=
unitCellGeo1
.
clone
();
cellGeometry1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeScale
(
scale
,
scale
,
scale
));
cellGeometry2
=
unitCellGeo2
.
clone
();
cellGeometry2
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeScale
(
scale
,
scale
,
scale
));
}
this
.
parts
=
this
.
_initParts
();
function
DMACell
(
mode
,
indices
,
scale
)
{
this
.
indices
=
indices
;
this
.
position
=
this
.
_calcPositionForScale
(
scale
);
this
.
parts
=
this
.
_initParts
();
this
.
drawForMode
(
mode
);
}
...
...
@@ -67,7 +76,7 @@
var
mesh
;
if
(
Math
.
round
(
position
.
z
/
octHeight
)
%
2
==
0
){
if
(
this
.
indices
.
z
%
2
==
0
){
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
cellGeometry1
,
cellMaterials
);
}
else
{
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
cellGeometry2
,
cellMaterials
);
...
...
@@ -76,6 +85,7 @@
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
;
};
...
...
This diff is collapsed.
Click to expand it.
js/models/lattice.js
+
1
−
1
View file @
e1fb1a5b
...
...
@@ -55,7 +55,7 @@ Lattice = Backbone.Model.extend({
}
var
index
=
this
.
_subtract
(
position
,
this
.
get
(
"
cellsMin
"
));
cells
[
index
.
x
][
index
.
y
][
index
.
z
]
=
new
DMACell
(
this
.
get
(
"
cellMode
"
),
position
);
cells
[
index
.
x
][
index
.
y
][
index
.
z
]
=
new
DMACell
(
this
.
get
(
"
cellMode
"
),
position
,
scale
);
this
.
set
(
"
numCells
"
,
this
.
get
(
"
numCells
"
)
+
1
);
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