|
Post by Guilect on Feb 18, 2007 12:02:19 GMT -5
Here is the requested beta version of V1.7. Download V1.7 Betacontains IDE brutus2d17beta.exe , new help file, and changelog file. Unzip to Brutus2d directory, run brutus2d17beta.exe changes: added -- console command 'wait' added -- console command 'inkey' added -- console object is now terminated upon any error encountered when running from the IDE. added -- graphics.MoveX imageindex, value (also MoveY, MoveXY); moves the image value amount from its current position. (this would be considered relative positioning; where .SetXY would be absolute). added -- math.GetAngle added -- math.AngleWrap added -- commands graphics.getworldx, getworldy added -- command MapViewXY changed -- behavior of math.clip function to be more traditional changed -- math.getguassein to math.rndn changed -- math.GetRndInt and math.GetRndReal to have the lowValue as the first argument and HighValue next. changed -- console.writeline; string argument is now optional. When omitted, the command prints a carriage return and a line feed. fixed -- console.clear; now clears background colors. fixed -- made math.swap command visible to B2D users. fixed -- emitted particles now move with setworldxy
|
|
|
Post by matthew on Feb 18, 2007 12:22:23 GMT -5
I'm still getting this Error. I haven't been able to run any of the Truevision3D Programmes for about a Day now.
|
|
|
Post by Guilect on Feb 18, 2007 12:53:43 GMT -5
Did not see the other post until now. Gave a suggestion in the other post.
|
|
|
Post by u9 on Feb 18, 2007 18:04:55 GMT -5
ndf, random_normal, rndn, RNOR, normal, "kært barn har mange navne." There are many different names for a random generator with a normal distribution. If it is in the math object, I still think you should call the function math.getRndNormal() for consistency with the math object and only call it rndn() if it is a function outside the math object like the rnd() function. Math.getRndNormal() is just more descriptive. I also still recommend implementing the input as the standard deviation. If there is no speed impact, i recommend changing math.AngleWrap to work with floats as this is what should be used by programs that wants to run the simulation at the same speed on different computers. Even with speed impact I probably still recommend this. I could not figure out what math.getCurveValue() does. I think there needs to be a much more detailed explanation in the manual. Math.getDirection also seems to require integer inputs. I recommend changing this to floats as velocity can often take a floating value or even just small values, in which case rounding errors make for a poor result. I have also noticed that the function considers x=0 and y=1 as 0 radians i.e. pointing straight up on a coordinate system. I recommend changing it to fit the unit circle so that x=1 and y=0 is 0 radians and x=0 and y=1 is pi/2 radians etc. This will make the function more usable with any other functions pertaining to rotation and orientation etc. as well as be more mathematical correct. The manual could also have mentioned that it will in fact return the angle in radians. Further testing seems to indicate that all the functions in the math object require integer inputs. I recommend changing them to floats where applicable. I also have noticed that where applicable, they consider 0 degrees to be pointing straight up rather then to the right. I recommend changing this to fit other mathematical functions and relationships or documenting this abnormality better. I'm not sure if all or only some, but e.g. math.getvelocityx seems to be negated making the effect that it seem to go clock-wise around the "unit" circle when the Direction increases. I also think that in general the math methods should have a little more information in the manual, e.g. "GetVelocityX ( Speed , Direction )" could state what Direction actually is. Ok now my beta version doesn't work any more so i cannot test graphics.movexy. Hopefully it also works with floating point numbers... P.s. Emitted particles did get moved when i change world coordinates excellent.
|
|
|
Post by u9 on Feb 18, 2007 18:10:54 GMT -5
P.s. graphics.movexy works perfectly
|
|
|
Post by Guilect on Feb 18, 2007 19:47:40 GMT -5
Actually it is math.GetRndN in the manual and in Brutus. Just in the change log was it RndN. It will be changed to Math.GetRndNormal
math.getCurveValue(), I can not put into words what it does any better than what is in the manual. I will have to come up with an example and see how you would describe it.
For all comments about going to Floats for inputs. I will look into it.
Yes, more info in the manual would be helpful. I try to find time.
|
|
|
Post by Guilect on Feb 18, 2007 20:10:48 GMT -5
GetCurveValue examples:
left-click and HOLD down the mouse in various spots on the screen.
Without GetCurveValue:
option explicit
dim bRunning bRunning = True
dim CI
sub main()
if (graphics.initialize <> True) then exit sub mouse.initialize CI = graphics.CreateImage(100,200) ' this creates a new image 100 x 200 pixels graphics.setxy CI, 200, 200 ' we locate the image's x position on the screen graphics.RenderImage CI ' this allows us to draw onto the new image graphics.setrect 0,0,100,200,&HFFFFFFFF graphics.RenderNormal ' here we say we are done drawing to the image graphics.setTitle "Demo - Create Image - press [ESC] to exit" key.initialize do while bRunning = True if key.pressed(1) or key.pressed(0) = True then bRunning = False If mouse.LeftButton then graphics.setxy CI, mouse.x, mouse.y graphics.clear graphics.setimage CI graphics.display loop key.terminate graphics.terminate
end sub
Call Main()
With GetCurveValue:
option explicit
dim bRunning bRunning = True
dim CI
sub main()
if (graphics.initialize <> True) then exit sub mouse.initialize CI = graphics.CreateImage(100,200) ' this creates a new image 100 x 200 pixels graphics.setxy CI, 200, 200 ' we locate the image's x position on the screen graphics.RenderImage CI ' this allows us to draw onto the new image graphics.setrect 0,0,100,200,&HFFFFFFFF graphics.RenderNormal ' here we say we are done drawing to the image graphics.setTitle "Demo - Create Image - press [ESC] to exit" key.initialize do while bRunning = True if key.pressed(1) or key.pressed(0) = True then bRunning = False If mouse.LeftButton then smooth graphics.clear graphics.setimage CI graphics.display loop key.terminate graphics.terminate
end sub
Call Main()
Sub smooth Dim X, Y X = math.getCurveValue(graphics.getx(CI),mouse.x, 100) Y = math.getCurveValue(graphics.gety(CI),mouse.y, 100) graphics.setxy CI, X, Y end sub
|
|
|
Post by hartnell on Feb 20, 2007 14:52:37 GMT -5
Ok, sorry it took me a whole two days to get the new beta. I'll be testing the new console methods. -hartnell
|
|
|
Post by hartnell on Feb 20, 2007 15:00:45 GMT -5
console.WriteLine and console.Wait work great. This isn't a biggie, but console.Wait doesn't seem to work with the escape key. I think this is probably the best behavior, as escape is used in loops. -hartnell
|
|
|
Post by u9 on Feb 21, 2007 10:28:55 GMT -5
It is true that escape is most often used in loops, but I think it is very (very) important to be consistent with the function. If it waits for a key, then please let it wait for ANY key. Don't pick out keys that are usually used for something (else?) by people.
|
|
|
Post by Guilect on Feb 21, 2007 17:16:55 GMT -5
The console object is created, written to, and read from using all standard Win32 API calls. The wait command uses 'ReadConsole' API call found in Kernel32.dll. There are several keys such as shift, esc, ctrl, and alt that are not part of the console input. If a key is not supported in that call then you will need to address it with Microsoft. If you wish to capture keys that were not part of the console era you can use the Brutus2D Key object.
|
|
|
Post by u9 on Feb 21, 2007 20:23:33 GMT -5
Oh... the console object my bad, I didn't see that. It makes sense that key-qualifiers (shift, ctrl, etc.) are not considered in such functions though.
|
|
|
Post by u9 on Feb 25, 2007 8:39:18 GMT -5
math.GetDirection seems to return the wrong value sometimes. Try
system.debugPrint math.GetDirection( -10, 0 ) * 180 / pi
Now ignoring which way the function considers 0 radians etc., as GetDirection is currently oriented I would expect this to return a value of 270 (3 quarters of a full circle), but it actually seems to be ~13 degrees off. I get a value of ~283.
|
|
|
Post by Guilect on Feb 25, 2007 8:42:24 GMT -5
I'll have a look.
|
|
|
Post by Guilect on Feb 25, 2007 10:37:39 GMT -5
The issue happens only when the second parameter is exactly equal to zero.
If you change your example to :
system.debugPrint math.GetDirection( -10, 0.0001 ) * 180 / pi if works.
here is the function, suggestions...
Const Pi = 3.14159265358979 Const TwoPi = 6.28318530717958 Const PiByTwo = 1.5707963267949 Const ThreePiByTwo = 4.93480220054467
Public Function GetDirection(ByVal xVelocity, ByVal yVelocity) Dim Direction If yVelocity < 0 Then Direction = Pi + Atn(xVelocity / yVelocity) ElseIf yVelocity > 0 Then Direction = Atn(xVelocity / yVelocity) If Direction < 0 Then Direction = Direction + TwoPi End If ElseIf xVelocity <= 0 Then Direction = ThreePiByTwo Else Direction = PiByTwo End If GetDirection = Direction End Function
|
|