Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Amanda Ghassaei
DMDesign
Commits
8892b5f6
Commit
8892b5f6
authored
Sep 14, 2015
by
Amanda Ghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complementary strands
parent
021f9bad
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
50 deletions
+96
-50
js/cells/DMACell.js
js/cells/DMACell.js
+5
-0
js/cells/DNABrickCell.js
js/cells/DNABrickCell.js
+30
-0
js/cells/GIKCell.js
js/cells/GIKCell.js
+9
-0
js/cells/supercells/GIKSuperCell.js
js/cells/supercells/GIKSuperCell.js
+6
-2
js/lattice/Lattice.js
js/lattice/Lattice.js
+0
-48
js/lattice/LatticeBase.js
js/lattice/LatticeBase.js
+41
-0
js/main.js
js/main.js
+1
-0
js/parts/DNAStraightPart.js
js/parts/DNAStraightPart.js
+4
-0
No files found.
js/cells/DMACell.js
View file @
8892b5f6
...
...
@@ -107,6 +107,11 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', '
return
superCellIndex
.
add
(
this
.
superCell
.
applyRotation
(
this
.
getIndex
()).
round
());
};
DMACell
.
prototype
.
getLatticeIndex
=
function
(){
var
parent
=
lattice
.
getUItarget
();
return
this
.
getAbsoluteIndex
().
sub
(
parent
.
get
(
"
cellsMin
"
));
};
DMACell
.
prototype
.
getPosition
=
function
(){
return
this
.
object3D
.
position
.
clone
();
};
...
...
js/cells/DNABrickCell.js
0 → 100644
View file @
8892b5f6
/**
* Created by aghassaei on 9/14/15.
*/
define
([
'
gikCell
'
],
function
(
GIKCell
){
function
DNABrickCell
(
json
,
superCell
){
GIKCell
.
call
(
this
,
json
,
superCell
);
}
DNABrickCell
.
prototype
=
Object
.
create
(
GIKCell
.
prototype
);
DNABrickCell
.
prototype
.
getCompliment
=
function
(
nucleotide
){
if
(
nucleotide
==
"
a
"
)
return
"
t
"
;
if
(
nucleotide
==
"
t
"
)
return
"
a
"
;
if
(
nucleotide
==
"
c
"
)
return
"
g
"
;
if
(
nucleotide
==
"
g
"
)
return
"
c
"
;
if
(
nucleotide
==
"
unassigned
"
)
return
null
;
console
.
warn
(
"
unknown nucleotide
"
+
nucleotide
);
return
null
;
};
DNABrickCell
.
prototype
.
getNucleotideAtIndex
=
function
(
index
){
if
(
this
.
parts
&&
this
.
parts
[
index
]
&&
this
.
parts
[
index
].
getNucleotide
)
return
this
.
parts
[
index
].
getNucleotide
();
return
"
unassigned
"
;
};
return
DNABrickCell
;
});
\ No newline at end of file
js/cells/GIKCell.js
View file @
8892b5f6
...
...
@@ -42,8 +42,17 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'],
});
}
else
if
(
lattice
.
get
(
"
partType
"
)
==
"
dnaStraight
"
)
{
require
([
'
dnaStraightPart
'
],
function
(
PartSubclass
){
var
parent
=
lattice
.
getUItarget
();
parent
.
_parseSparseCell
();
//todo this should get checked
var
index
=
self
.
getLatticeIndex
();
if
(
parent
.
cells
[
index
.
x
][
index
.
y
][
index
.
z
+
1
])
var
topNeighbor
=
parent
.
cells
[
index
.
x
][
index
.
y
][
index
.
z
+
1
];
if
(
parent
.
cells
[
index
.
x
][
index
.
y
][
index
.
z
-
1
])
var
bottomNeighbor
=
parent
.
cells
[
index
.
x
][
index
.
y
][
index
.
z
-
1
];
for
(
var
i
=
0
;
i
<
16
;
i
++
){
var
nucleotide
=
null
;
if
(
topNeighbor
&&
i
<
8
)
nucleotide
=
self
.
getCompliment
(
topNeighbor
.
getNucleotideAtIndex
(
i
+
8
));
if
(
bottomNeighbor
&&
i
>
7
)
nucleotide
=
self
.
getCompliment
(
bottomNeighbor
.
getNucleotideAtIndex
(
i
-
8
));
parts
.
push
(
new
PartSubclass
(
self
.
index
.
x
,
self
,
{
nuclType
:
nucleotide
,
vertIndex
:
i
,
isBridge
:
false
}));
...
...
js/cells/supercells/GIKSuperCell.js
View file @
8892b5f6
...
...
@@ -4,8 +4,8 @@
define
([
'
underscore
'
,
'
three
'
,
'
threeModel
'
,
'
lattice
'
,
'
appState
'
,
'
superCell
'
,
'
gikCell
'
],
function
(
_
,
THREE
,
three
,
lattice
,
appState
,
DMASuperCell
,
GIKCell
){
define
([
'
underscore
'
,
'
three
'
,
'
threeModel
'
,
'
lattice
'
,
'
appState
'
,
'
superCell
'
,
'
gikCell
'
,
'
dnaBrickCell
'
],
function
(
_
,
THREE
,
three
,
lattice
,
appState
,
DMASuperCell
,
GIKCell
,
DNABrickCell
){
var
unitGeos
=
{};
...
...
@@ -30,6 +30,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
GIKSuperCell
.
prototype
.
_makeSubCellForIndex
=
function
(
json
,
callback
){
json
.
materialName
=
this
.
materialName
;
if
(
lattice
.
get
(
"
latticeType
"
)
==
"
dnaBricks
"
){
callback
(
new
DNABrickCell
(
json
,
this
));
return
;
}
callback
(
new
GIKCell
(
json
,
this
));
};
...
...
js/lattice/Lattice.js
View file @
8892b5f6
...
...
@@ -171,54 +171,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
//cells array
_parseSparseCell
:
function
(){
this
.
cells
=
[[[
null
]]];
console
.
log
(
"
parse cells
"
);
if
(
this
.
get
(
"
numCells
"
)
==
0
)
{
console
.
warn
(
"
no cells in assembly
"
);
this
.
cells
=
[[[
null
]]];
return
;
}
var
bounds
=
this
.
calculateBoundingBox
();
this
.
set
(
"
denseCellsMin
"
,
bounds
.
min
.
clone
().
add
(
this
.
get
(
"
cellsMin
"
)));
var
size
=
bounds
.
max
.
sub
(
bounds
.
min
);
//create array of nulls
var
cells
=
[];
for
(
var
x
=
0
;
x
<
size
.
x
;
x
++
){
cells
.
push
([]);
for
(
var
y
=
0
;
y
<
size
.
y
;
y
++
){
cells
[
x
].
push
([]);
for
(
var
z
=
0
;
z
<
size
.
z
;
z
++
){
cells
[
x
][
y
].
push
(
null
);
}
}
}
var
min
=
this
.
get
(
"
cellsMin
"
).
sub
(
bounds
.
min
);
var
overlap
=
false
;
var
forCAM
=
appState
.
get
(
"
currentNav
"
)
==
"
navAssemble
"
;
this
.
_loopCells
(
this
.
sparseCells
,
function
(
cell
){
if
(
!
cell
)
return
;
overlap
|=
cell
.
addToDenseArray
(
cells
,
min
,
forCAM
);
});
this
.
set
(
"
overlapDetected
"
,
overlap
);
this
.
cells
=
cells
;
},
//3d ui
...
...
js/lattice/LatticeBase.js
View file @
8892b5f6
...
...
@@ -447,6 +447,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
if
(
cell
)
cell
.
show
();
});
}
this
.
_iterCells
(
this
.
sparseCells
,
function
(
cell
){
if
(
cell
)
cell
.
setMode
(
cellMode
,
function
(){
if
(
--
numCells
<=
0
)
three
.
render
();
...
...
@@ -520,6 +521,46 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
return
{
x
:
xScale
,
y
:
yScale
,
z
:
zScale
};
},
_parseSparseCell
:
function
(){
this
.
cells
=
[[[
null
]]];
console
.
log
(
"
parse cells
"
);
if
(
this
.
get
(
"
numCells
"
)
==
0
)
{
console
.
warn
(
"
no cells in assembly
"
);
this
.
cells
=
[[[
null
]]];
return
;
}
var
bounds
=
this
.
calculateBoundingBox
();
this
.
set
(
"
denseCellsMin
"
,
bounds
.
min
.
clone
().
add
(
this
.
get
(
"
cellsMin
"
)));
var
size
=
bounds
.
max
.
sub
(
bounds
.
min
);
//create array of nulls
var
cells
=
[];
for
(
var
x
=
0
;
x
<
size
.
x
;
x
++
){
cells
.
push
([]);
for
(
var
y
=
0
;
y
<
size
.
y
;
y
++
){
cells
[
x
].
push
([]);
for
(
var
z
=
0
;
z
<
size
.
z
;
z
++
){
cells
[
x
][
y
].
push
(
null
);
}
}
}
var
min
=
this
.
get
(
"
cellsMin
"
).
sub
(
bounds
.
min
);
var
overlap
=
false
;
var
forCAM
=
appState
.
get
(
"
currentNav
"
)
==
"
navAssemble
"
;
this
.
_loopCells
(
this
.
sparseCells
,
function
(
cell
){
if
(
!
cell
)
return
;
overlap
|=
cell
.
addToDenseArray
(
cells
,
min
,
forCAM
);
});
this
.
set
(
"
overlapDetected
"
,
overlap
);
this
.
cells
=
cells
;
},
...
...
js/main.js
View file @
8892b5f6
...
...
@@ -96,6 +96,7 @@ require.config({
compositeCell
:
"
cells/supercells/CompositeCell
"
,
hexCell
:
'
cells/HexagonalCell
'
,
hexRotCell
:
'
cells/HexagonalRotCell
'
,
dnaBrickCell
:
'
cells/DNABrickCell
'
,
//parts
part
:
'
parts/DMAPart
'
,
...
...
js/parts/DNAStraightPart.js
View file @
8892b5f6
...
...
@@ -41,6 +41,10 @@ define(['underscore', 'stlLoader', 'gikPart'], function(_, THREE, GIKPart){
return
'
g
'
;
};
DNAStraightPart
.
prototype
.
getNucleotide
=
function
(){
return
this
.
_nuclType
;
};
DNAStraightPart
.
prototype
.
_getGeometry
=
function
(){
if
(
this
.
_isBridge
)
return
bridgeGeo
;
return
unitGeo
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment