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
21a31e9b
Commit
21a31e9b
authored
10 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
cell subclasses
parent
2b1be52c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/fea/DmaCell.js
+95
-2
95 additions, 2 deletions
js/fea/DmaCell.js
with
95 additions
and
2 deletions
js/fea/DmaCell.js
+
95
−
2
View file @
21a31e9b
...
@@ -100,7 +100,6 @@ DMACell.prototype.destroy = function(){
...
@@ -100,7 +100,6 @@ DMACell.prototype.destroy = function(){
var
unitOctHeight
=
2
/
Math
.
sqrt
(
6
);
var
unitOctHeight
=
2
/
Math
.
sqrt
(
6
);
var
unitCellGeo1
=
new
THREE
.
OctahedronGeometry
(
1
/
Math
.
sqrt
(
2
));
var
unitCellGeo1
=
new
THREE
.
OctahedronGeometry
(
1
/
Math
.
sqrt
(
2
));
unitCellGeo1
.
dynamic
=
true
;
unitCellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
-
3
*
Math
.
PI
/
12
));
unitCellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationZ
(
-
3
*
Math
.
PI
/
12
));
unitCellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationX
(
Math
.
asin
(
2
/
Math
.
sqrt
(
2
)
/
Math
.
sqrt
(
3
))));
unitCellGeo1
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationX
(
Math
.
asin
(
2
/
Math
.
sqrt
(
2
)
/
Math
.
sqrt
(
3
))));
...
@@ -153,3 +152,97 @@ DMACell.prototype.destroy = function(){
...
@@ -153,3 +152,97 @@ DMACell.prototype.destroy = function(){
self
.
DMASideOctaCell
=
DMASideOctaCell
;
self
.
DMASideOctaCell
=
DMASideOctaCell
;
})();
})();
///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////OCTA VERTEX CLASS//////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
(
function
()
{
var
unitCellGeo
=
new
THREE
.
OctahedronGeometry
(
1
/
Math
.
sqrt
(
2
));
var
cellMaterials
=
[
new
THREE
.
MeshNormalMaterial
(),
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
wireframe
:
true
})];
function
DMAVertexOctaCell
(
mode
,
indices
,
scale
,
lattice
){
DMACell
.
call
(
this
,
mode
,
indices
,
scale
,
lattice
);
}
DMAVertexOctaCell
.
prototype
=
Object
.
create
(
DMACell
.
prototype
);
DMAVertexOctaCell
.
prototype
.
_calcPosition
=
function
(
scale
,
indices
){
var
position
=
{};
// var octHeight = 2*scale/Math.sqrt(6);
// var triHeight = scale/2*Math.sqrt(3);
// position.x = indices.x*scale;
// position.y = indices.y*triHeight;
// position.z = indices.z*octHeight;
// if (Math.abs(indices.y%2) == 1) position.x -= scale/2;
// if (Math.abs(indices.z%2) == 1) position.y -= triHeight*4/3;
return
position
;
};
DMAVertexOctaCell
.
prototype
.
_initParts
=
function
(
zIndex
){
var
parts
=
[];
for
(
var
i
=
0
;
i
<
3
;
i
++
){
parts
.
push
(
new
DMAPart
(
i
,
zIndex
%
2
==
1
,
this
));
}
return
parts
;
};
DMAVertexOctaCell
.
prototype
.
_buildCellMesh
=
function
(
zIndex
){
//abstract mesh representation of cell
var
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
unitCellGeo
,
cellMaterials
);
mesh
.
myCell
=
this
;
//we need a reference to this instance from the mesh for intersection selection stuff
return
mesh
;
};
self
.
DMAVertexOctaCell
=
DMAVertexOctaCell
;
})();
///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////CUBE CELL CLASS////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
(
function
()
{
var
unitCellGeo
=
new
THREE
.
BoxGeometry
(
1
,
1
,
1
);
unitCellGeo
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeTranslation
(
1
/
2
,
1
/
2
,
1
/
2
));
var
cellMaterials
=
[
new
THREE
.
MeshNormalMaterial
(),
new
THREE
.
MeshBasicMaterial
({
color
:
0x000000
,
wireframe
:
true
})];
function
DMACubeCell
(
mode
,
indices
,
scale
,
lattice
){
DMACell
.
call
(
this
,
mode
,
indices
,
scale
,
lattice
);
}
DMACubeCell
.
prototype
=
Object
.
create
(
DMACell
.
prototype
);
DMACubeCell
.
prototype
.
_calcPosition
=
function
(
scale
,
indices
){
var
position
=
_
.
clone
(
indices
);
_
.
each
(
_
.
keys
(
position
),
function
(
key
){
position
.
key
*=
scale
;
});
return
position
;
};
DMACubeCell
.
prototype
.
_initParts
=
function
(
zIndex
){
var
parts
=
[];
for
(
var
i
=
0
;
i
<
4
;
i
++
){
parts
.
push
(
new
DMAPart
(
0
,
zIndex
%
2
==
1
,
this
));
}
return
parts
;
};
DMACubeCell
.
prototype
.
_buildCellMesh
=
function
(
zIndex
){
//abstract mesh representation of cell
var
mesh
=
THREE
.
SceneUtils
.
createMultiMaterialObject
(
unitCellGeo
,
cellMaterials
);
mesh
.
myCell
=
this
;
//we need a reference to this instance from the mesh for intersection selection stuff
return
mesh
;
};
self
.
DMAVertexOctaCell
=
DMACubeCell
;
})();
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