Bug with ScaleEntity? (0.3)

BlitzMax Forums/MiniB3D Module/Bug with ScaleEntity? (0.3)

impixi(Posted 2007) [#1]
Unless I'm overlooking something completely obvious, I think I've found a bug with ScaleEntity: It does not seem to scale the applicable entity on the Z axis.

BlitzMax + MiniB3D Code:




Equivalent Blitz3D Code:




H&K(Posted 2007) [#2]
well, as MiniB3D is in the public domain, why dont you have a look at the code, and see if you can find the problem

That isnt to say that posting this is bad, just that you should be as able as say I to fix it.


H&K(Posted 2007) [#3]
Lines 5942 - 5980
Method TForm(px#,py#,pz#,rx#,ry#,rz#,sx#,sy#,sz#)
	
		' identity

		grid[0,3]=0.0
		grid[1,3]=0.0
		grid[2,3]=0.0
		grid[3,3]=1.0
	
		' translate
	
		grid[3,0] = px#
		grid[3,1] = py#
		grid[3,2] = pz#
	
		' rotate + scale
		
		Local cos_ang1#=Cos(ry)
		Local sin_ang1#=Sin(ry)

		Local cos_ang2#=Cos(rx)
		Local sin_ang2#=Sin(rx)
		
		Local cos_ang3#=Cos(rz)
		Local sin_ang3#=Sin(rz)

		grid[2,0] = (sin_ang1 * cos_ang2) * sx#
		grid[2,1] = (-sin_ang2) * sx#
		grid[2,2] = (cos_ang1 * cos_ang2) * sx#
	
		grid[1,0] = ((cos_ang1# * -sin_ang3#) + ((sin_ang1 * sin_ang2) * cos_ang3#)) * sy#
		grid[1,1] = (cos_ang2 * cos_ang3#) * sy#
		grid[1,2] = (-sin_ang1# * -sin_ang3#) + ((cos_ang1 * sin_ang2) * cos_ang3#) * sy#

		grid[0,0] = ((cos_ang1# * cos_ang3#) + ((sin_ang1 * sin_ang2) * sin_ang3#)) * sz#
		grid[0,1] = (cos_ang2 * sin_ang3#) * sz#
		grid[0,2] = ((-sin_ang1# * cos_ang3#) + ((cos_ang1 * sin_ang2) * sin_ang3#)) * sz#
	
	End Method

this bit at the end was wrong
Lines 5976 - 5979
     grid[0,0] = ((cos_ang1# * cos_ang3#) + ((sin_ang1 * sin_ang2) * sin_ang3#)) * sz#
     grid[0,1] = (cos_ang2 * sin_ang3#) * sz#
     grid[0,2] = ((-sin_ang1# * cos_ang3#) + ((cos_ang1 * sin_ang2) * sin_ang3#)) * sz#

It originaly had sx change it to sz

Now that took me twenty mins, includeing downloading minib3d. You could have done that. Then posted the correction.

Maybe it would have been hard to find, and you would have given up. But in this case is wasnt, and I beleave your a good enough programmer to have found it. Just have a little confidence that you might be just as good a programmer as anyone else here, and maybe you will discover that you are.


impixi(Posted 2007) [#4]
I don't understand your hostile attitude, but it's certainly not constructive.

Some of us have 'distractions' that ensure somewhat sporadic time at the keyboard. The intention was to post the apparent bug in case others were experiencing related issues and, as you mention, hunt down the bug myself and post any fix if I found one. This is actually how it's done in the 'real world'.


H&K(Posted 2007) [#5]
I dont think I was hostile. A little short maybe, but not hostile. My point still holds, that it would problably been quicker for you to find the bug than to write and post some code to show the error.

All you had to do, was look at the code for ScaleEntity, which called entity.ScaleEntity, which simply called Tform, and there it was.

If I had been hostile, I assure you I wouldnt have been as nice as to say I beleved you capable of finding it yourself. And it is constructive, because I found the error, corrected it, then tried to ego boost you into trying to fix the next one yourself.

If anything it was patronising.


H&K(Posted 2007) [#6]
In fact re error, it might be that Ive changed the wrong set of three equations.

So can someone who knows looksee if is should have been the third set, or the first set that needed changing.

In fact, I might be totaly wrong and the error isnt this at all


impixi(Posted 2007) [#7]
Yes, H&K, it's the first set (I think).

Lines 5968 to 5970 should be:

grid[2,0] = (sin_ang1 * cos_ang2) * sz#
grid[2,1] = (-sin_ang2) * sz#
grid[2,2] = (cos_ang1 * cos_ang2) * sz#


Possibly.


simonh(Posted 2007) [#8]
Yep, it's the first set. Cheers.