Revision fce25d04
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java | ||
---|---|---|
131 | 131 |
float sinAnorm = (float)Math.sin(qa/2)/len; |
132 | 132 |
mSta4.set(sinAnorm*qx,sinAnorm*qy,sinAnorm*qz, cosA); |
133 | 133 |
break; |
134 |
case MOVE : float s = 0.04f; |
|
135 |
float xm = (mInter[0]-50)*s; |
|
136 |
float ym = (mInter[1]-50)*s; |
|
137 |
float zm = (mInter[2]-50)*s; |
|
134 |
case MOVE : float sw = mAct.get().getScreenWidth()/50.0f; |
|
135 |
float sh = mAct.get().getScreenWidth()/50.0f; |
|
136 |
float xm = (mInter[0]-50)*sw; |
|
137 |
float ym = (mInter[1]-50)*sh; |
|
138 |
float zm = (mInter[2]-50)*(sw+sh)/2; |
|
138 | 139 |
mSta3.set(xm,ym,zm); |
139 | 140 |
break; |
140 |
case SCALE : double coeff = Math.PI / 100; |
|
141 |
|
|
142 |
if( mInter[0]<= 0 ) mInter[0]= 1; |
|
143 |
if( mInter[0]>=100 ) mInter[0]=99; |
|
144 |
if( mInter[1]<= 0 ) mInter[1]= 1; |
|
145 |
if( mInter[1]>=100 ) mInter[1]=99; |
|
146 |
if( mInter[2]<= 0 ) mInter[2]= 1; |
|
147 |
if( mInter[2]>=100 ) mInter[2]=99; |
|
148 |
|
|
149 |
float xs = (float)Math.tan((mInter[0]-50)*coeff); |
|
150 |
float ys = (float)Math.tan((mInter[1]-50)*coeff); |
|
151 |
float zs = (float)Math.tan((mInter[2]-50)*coeff); |
|
141 |
case SCALE : float xs = (mInter[0]>50 ? 0.18f : 0.018f)*(mInter[0]-50) + 1; |
|
142 |
float ys = (mInter[1]>50 ? 0.18f : 0.018f)*(mInter[1]-50) + 1; |
|
143 |
float zs = (mInter[2]>50 ? 0.18f : 0.018f)*(mInter[2]-50) + 1; |
|
152 | 144 |
mSta3.set(xs,ys,zs); |
153 | 145 |
break; |
154 | 146 |
case SHEAR : float xsh = (mInter[0]-50)/25.0f; |
... | ... | |
213 | 205 |
case 1: mInter[0] = 50; |
214 | 206 |
} |
215 | 207 |
|
216 |
if( mName==EffectNames.ROTATE || mName==EffectNames.QUATERNION ) |
|
217 |
{ |
|
218 |
mInter[1]= 100; |
|
219 |
} |
|
220 |
if( mName==EffectNames.SCALE ) |
|
221 |
{ |
|
222 |
mInter[0]= 75; |
|
223 |
mInter[1]= 75; |
|
224 |
mInter[2]= 75; |
|
225 |
} |
|
208 |
if( mName==EffectNames.ROTATE || mName==EffectNames.QUATERNION ) mInter[1]= 100; |
|
226 | 209 |
} |
227 | 210 |
|
228 | 211 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
278 | 261 |
|
279 | 262 |
private void fillCenterStatics() |
280 | 263 |
{ |
281 |
float x = (mInterCenter[0]-50)*0.02f; |
|
282 |
float y = (mInterCenter[1]-50)*0.02f; |
|
283 |
float z = (mInterCenter[2]-50)*0.02f; |
|
264 |
Effects3DActivity act = mAct.get(); |
|
265 |
|
|
266 |
float x = (mInterCenter[0]*0.012f - 0.1f)*act.getWidth(); |
|
267 |
float y = (mInterCenter[1]*0.012f - 0.1f)*act.getHeight(); |
|
268 |
float z = (mInterCenter[2]*0.012f - 0.1f)*act.getDepth(); |
|
284 | 269 |
|
285 | 270 |
mCenterSta.set(x,y,z); |
286 | 271 |
} |
... | ... | |
298 | 283 |
|
299 | 284 |
private void setCenterText() |
300 | 285 |
{ |
301 |
float f0 = ((int)(mCenterSta.getX()*100))/100.0f;
|
|
302 |
float f1 = ((int)(mCenterSta.getY()*100))/100.0f;
|
|
303 |
float f2 = ((int)(mCenterSta.getZ()*100))/100.0f;
|
|
286 |
int f0 = (int)mCenterSta.getX();
|
|
287 |
int f1 = (int)mCenterSta.getY();
|
|
288 |
int f2 = (int)mCenterSta.getZ();
|
|
304 | 289 |
|
305 | 290 |
mTextCenter.setText("center ("+f0+","+f1+","+f2+")"); |
306 | 291 |
} |
Also available in: Unified diff
Revert "Progress with the last 2 Apps: Effects3D and Wind (not done yet)"
This reverts commit 752c6b57bb227292e6c28438b955fcb892f7acc6.