Skip to content
Snippets Groups Projects
Commit ce846a22 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

init part geometry

parent 350a1812
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ BeamNode.prototype.addBeam = function(beam){
BeamNode.prototype.render = function(){
var geometry = new THREE.SphereGeometry(2);
var geometry = new THREE.BoxGeometry(2,2,2);
geometry.applyMatrix( new THREE.Matrix4().makeTranslation(this.x, this.y, this.z) );
var mesh = new THREE.Mesh(geometry);
......
......@@ -5,12 +5,16 @@
//a part, element with a single material, handled by assembler
function Part(nodes, config) {//list of nodes, config tells how nodes are connected
this.nodes = nodes;
this.beams = this._createBeams(nodes, config);
};
Part.prototype._createBeams = function(nodes, config){
function DmaPart(geometry) {//list of nodes, config tells how nodes are connected
// this.nodes = nodes;
// this.beams = this._createBeams(nodes, config);
this.geometry = geometry;
this.render();
}
DmaPart.prototype._createBeams = function(nodes, config){
var beams = [];
_.each(config, function(pair){
beams.push(new Beam(nodes[pair[0]], nodes[pair[2]]));
......@@ -18,21 +22,27 @@ Part.prototype._createBeams = function(nodes, config){
return beams;
};
Part.prototype.render = function(scene){
DmaPart.prototype.render = function(){
var mesh = new THREE.Mesh(this.geometry);
window.three.sceneAdd(mesh);
window.three.render();
};
Part.prototype.translate = function(dx, dy, dz){
DmaPart.prototype.translate = function(dx, dy, dz){
};
Part.prototype.rotate = function(rx, ry, rz){
DmaPart.prototype.rotate = function(rx, ry, rz){
};
//////////////////////////////////////////////////////////////
/////////////////SUBCLASSES///////////////////////////////////
//////////////////////////////////////////////////////////////
//matt's part
function PartTriangle(nodes){
}
PartTriangle.prototype = new Part(nodes, [[0,1],[1,2],[2,0]]);
\ No newline at end of file
////matt's part
//function PartTriangle(){
//}
//
//PartTriangle.prototype = new DmaPart();
\ No newline at end of file
......@@ -26,5 +26,18 @@ $(function(){
var threeView = new ThreeView({model:threeModel, highlightTargets:highlightTargets});
//first, pre load the stl
part_loadSTL();
function part_loadSTL(){
var loader = new THREE.STLLoader();
loader.addEventListener('load', part_onMeshLoad);
loader.load('data/Airbus_A300-600.stl');
}
function part_onMeshLoad(e){
new DmaPart(e.content);
}
setupNavBar(threeModel);
});
......@@ -41,7 +41,7 @@
<!--fea stuff-->
<script src="js/fea/dmaCell.js"></script>
<!--<script src="js/fea/dmaPart.js"></script>-->
<script src="js/fea/dmaPart.js"></script>
<!--<script src="js/fea/dmaBeam.js"></script>-->
<script src="js/fea/dmaNode.js"></script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment