From b21d315866684470cacb13fd6c63f877da0e4db5 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 1 Apr 2015 00:59:33 -0400 Subject: [PATCH] low poly part --- assets/stls/parts/edgeVoxPartLowPoly.stl | Bin 34688 -> 6684 bytes js/fea/DmaCell.js | 3 +++ js/fea/DmaCellOcta.js | 17 ++++++++++++- js/fea/DmaPart.js | 30 +++++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/assets/stls/parts/edgeVoxPartLowPoly.stl b/assets/stls/parts/edgeVoxPartLowPoly.stl index 42ad99e0e53e5cc1443780d51e551ce4677ce582..efef6ae803fd1e357be42cd9bb331ea7f8b14cee 100644 GIT binary patch literal 6684 zcmb`LO{i5>6vsCxLP+Suff#B8B?K9I-%X6mc@e18D;hPZnK%oYS5T)2L4rv7qL3Oi z2pTl7_bv{+oXQ@l7>GD&R^qG=>uIS4-PUjIz0Ucc`?OJqu4liq_W%6X_g<%`AKkzG z|GZvLdezPL?-oYq&n-;u-m`=CMAoCT=N3jhcSN0W84;2h#3Y`lbam~V<GAZC-UkQI z_}v~65=F4)ImoQlFZTYwGDmC2J!aE=w$tv;5jLfC{nYyLZ?^mTj8=*`W7>h{4o6+_ z&-c^)Lu0Rs?xTCl`gHbPRkRwlh!lvBD1tT5LA$TuaG#lFt>1MQ&pSKJt35<W6rp^) zoy%=W#oCIytS7d{a(|xp3!;@MqWG!`U!`Q;t-`xlNW^rP+LzKzi^tD~hzQ;ap?q!w zc~$e1Y;d09Y0u?|Q;T4cK!illim-SPIon)gJrM$dHzfxC96p}62tYlFBE)h-NCYd> zq|G1Q#q-d1H6kR6P(D+}uNr@)5(AG#@u=5Fi8*V}UG`>#N@fsIU4~eG?#^MUsGhGB zy;>`ad2`d^t`bEEpK(Yp!B=erH8v8>TOdkic)dk5L3a`S!!-Kceh*DP7{mU@nzhuy z<c8hZb<Qg_rLWI#wCHiI*ltiM9a!S;kSJo=ch4V3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yR6-0s}O40oTxkA$Z*l+nJlmzYJ z>y~zj>w=nT(1a`vVOqVgLDeMKFhgIwn3&x)9R@f)qr7s;&XjxNrlBYt0rKRAlF`)_ zaUTa}=}N7zIn^9kLDq^_TlIeu1}TSp0x9uRT7&qQ9bV44un%7}iqsfe8qJ_>#Biq= zaP0~*u=R^qa;vb|%8spJu5S0y+hVxz`B;wOQ_f%LCh;K@lv-hHYAM{AY`BjC%cC8% zfO9@UA=whM&sVFmr{$!EMCA3ETBxN^uIy6^3cUgf5GTO$1ULyjcw(o;;GN_wv#DiP z&Y+>a;jiYjVs2`sK#|x)JEpgJw+Vx#TG**|7+_K%O~O3O#D1fbMGNgcj@uw1oYb|z zECS!DXn~b8Xd$Fa!%v)&NeJdmKTu(sop?H87H3jM2IX}^A=ENpBZOpN_Kk3L5Bx&5 zks788fem-sUR9(}9s*)HMq#(b>T?v(a`?rHAu@~lRBDB-sikmh<OmIiU#t|)Gt1eX zvE{8frMIj0x&0EOlY$Wf8;-y2Z>Pb?WD|SA*VV%2luH}SmE+Sf>=k|vyECoiQ~K4@ zayI=%JGw>qBXhBq(XN<*n0y!+P{h=`#fN6EXUu46B3_POvNmz<6-1>@8?*PvQ$V?G za~~!I+AcJ=Bi)D@De$#S-5OY>$emy=P>frr6ihyqe^AL$8MP4H;WQ30+jvC`w{a*{ Tk;3l<2KuKT-@bnN{g?j%hNw@> diff --git a/js/fea/DmaCell.js b/js/fea/DmaCell.js index e44345cd..cb00ab34 100644 --- a/js/fea/DmaCell.js +++ b/js/fea/DmaCell.js @@ -167,6 +167,9 @@ DMACell.prototype._initParts = function(){ return [];//override in subclasses }; +DMACell.prototype.changePartType = function(){//override in subclasses +}; + DMACell.prototype.removePart = function(index){ this.parts[index].destroy(); this.parts[index] = null; diff --git a/js/fea/DmaCellOcta.js b/js/fea/DmaCellOcta.js index fda02f81..a0a1afc1 100644 --- a/js/fea/DmaCellOcta.js +++ b/js/fea/DmaCellOcta.js @@ -156,7 +156,22 @@ function DMARotatedEdgeCell(indices, scale, cellMode, partType){ DMARotatedEdgeCell.prototype = Object.create(DMACell.prototype); DMARotatedEdgeCell.prototype._initParts = function(){ - return [new DMAEdgeVoxPart(0, this)]; + return this.changePartType(dmaGlobals.lattice.get("partType")); +}; + +DMARotatedEdgeCell.prototype.changePartType = function(type){ + var newParts = []; + if (type == "vox"){ + newParts.push(new DMAEdgeVoxPart(0, this)); + } else if (type == "voxLowPoly"){ + newParts.push(new DMAEdgeVoxPartLowPoly(0, this)); + } else { + console.warn("part type not recognized"); + return; + } + if (!this.parts) return newParts; + this.destroyParts(); + this.parts = newParts; }; DMARotatedEdgeCell.prototype._doMeshTransformations = function(mesh){ diff --git a/js/fea/DmaPart.js b/js/fea/DmaPart.js index 48afeb37..804b40e2 100644 --- a/js/fea/DmaPart.js +++ b/js/fea/DmaPart.js @@ -180,6 +180,36 @@ var partMaterial = new THREE.MeshLambertMaterial({ color:0xffffff, shading: THRE })(); +(function () { + + var unitPartGeo; + + //import part geometry + var loader = new THREE.STLLoader(); + loader.load("assets/stls/parts/edgeVoxPartLowPoly.stl", function(geometry){ + + unitPartGeo = geometry; + unitPartGeo.computeBoundingBox(); + var unitScale = 0.706/unitPartGeo.boundingBox.max.y; + unitPartGeo.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale)); + }); + + function DMAEdgeVoxPartLowPoly(type, parent){ + DMAPart.call(this, type, parent); + } + DMAEdgeVoxPartLowPoly.prototype = Object.create(DMAPart.prototype); + + DMAEdgeVoxPartLowPoly.prototype._makeMeshForType = function(){ + var mesh = new THREE.Mesh(unitPartGeo, partMaterial); + mesh.myPart = this;//need a ref back to this part + return mesh; + }; + + self.DMAEdgeVoxPartLowPoly = DMAEdgeVoxPartLowPoly; + +})(); + + (function () { var unitPartGeo; -- GitLab