Search found 2909 matches

by Richard
Apr 20, 2007 3:01
Forum: General
Topic: Image Rotation
Replies: 7
Views: 2107

you have not assigned values of cx and cy to x and y inside the loop
by Richard
Apr 20, 2007 2:06
Forum: General
Topic: Image Rotation
Replies: 7
Views: 2107

You are using trigonometry. Better to do vector rotation which is a complex multiply. It is much faster. This will speed it up but not fill in the holes. dim as double (all but loop counter) To rotate by a radian angle rot, firstly rotx = cos(rot) ' convert angle to a unity vector roty = sin(rot) th...
by Richard
Apr 19, 2007 23:02
Forum: Beginners
Topic: Getting the value of a variable variable
Replies: 7
Views: 1690

@pritchard: Neither, possibly both. This attempt to apply run-time output of a program to the compile-time symbol table management hits the problem of reverse time travel. cha0s was quite correct. Even if FreeBASIC was an interpreter, the syntax and structure of the language precludes such things. A...
by Richard
Apr 19, 2007 4:06
Forum: Beginners
Topic: Getting the value of a variable variable
Replies: 7
Views: 1690

mouse.x refers to an undefined (user defined type?) variable. If "mouse.x" was a symbol that was associated with a value of 5, you would need to assign it to a string variable, then you could search the symbol with instring() to find its components. From this you could work out the value 5. a+c conc...
by Richard
Apr 19, 2007 3:22
Forum: General
Topic: Polygon Challenge
Replies: 26
Views: 4243

Area of a Polygon.

Here is a vector based polygon area algorithm. This should get you started. I have kept it simple and over documented. Just why or how you divide your polygon may make vector rotation and translation of the polygon a better solution than the intersection of the line with the edges. There is insuffic...
by Richard
Apr 13, 2007 21:50
Forum: General
Topic: Cautions when using For:Next loops
Replies: 7
Views: 2393

Firstly: There is no question that Pritchard s terminal condition is the work-around to stop the counter falling off the edge of the universe. Full marks to Pritchard for this solution. Steven522 presented a more universal solution, but failed to make the point clearly that if the step size was not...
by Richard
Apr 13, 2007 9:17
Forum: General
Topic: Cautions when using For:Next loops
Replies: 7
Views: 2393

Cautions when using For:Next loops

Firstly: For Next loops will not terminate at the end of a data type range because overflow is not flagged when the counter variable is stepped prior to the range validity test. For "Byte" = -128 to 126 works but For "Byte" = -128 to 127 is an infinite loop because +128 is -128 in Byte. For "Ubyte" ...
by Richard
Mar 29, 2007 20:18
Forum: General
Topic: Numbers in Scientific Format, unexpected output.
Replies: 0
Views: 868

Numbers in Scientific Format, unexpected output.

Formatting numbers is important because it gets them through the eyes and into the brain. The following code shows unexpected output from both "print using" and "format" keywords. #include "vbcompat.bi" Dim As String result, formatting_expression = "000E+00" Dim As Double numeric...
by Richard
Mar 26, 2007 16:18
Forum: Documentation
Topic: Open Pipe example does not work
Replies: 6
Views: 3721

We overlapped. Yes I need to get a Wiki account so I can correct the odd typo. Thanks counting_pine for that solution.
by Richard
Mar 26, 2007 16:09
Forum: Documentation
Topic: Open Pipe example does not work
Replies: 6
Views: 3721

It is clear that the external "command" is being automatically prefixed with the current directory, CurDir. Effectivly we have (for DOS and Windows); Open pipe (CurDir & "\" & command) For Input As #1 This is not clearly documented. Since the following works, but not once "C:\program files" ...
by Richard
Mar 26, 2007 15:10
Forum: Documentation
Topic: Open Pipe example does not work
Replies: 6
Views: 3721

There is an extra double quote in the "ChDir" example, I have used it with the "Open pipe" example. This combination does work. Dim pathname As String = "C:\program files\FreeBASIC" Dim result As Integer = ChDir(pathname) If 0 <> result Then Print "error changing current direc...
by Richard
Mar 21, 2007 0:20
Forum: Documentation
Topic: Open Pipe example does not work
Replies: 6
Views: 3721

Open Pipe example does not work

The Open Pipe example in the FreeBASIC Manual help does not work because "fbc.exe" is not recognised as an internal or external command, or program when run under FBIde. Maybe this example should create its own command or use a different command that is always available. Dim text As String Open Pipe...
by Richard
Mar 13, 2007 1:16
Forum: General
Topic: hexadecimal
Replies: 13
Views: 1928

I think this might be just what you wanted. ' Twos complement ' +1 = not defined ' +.99999 = binary .011111 ' +.50000 = binary .010000 ' 0 = binary .000000 ' -.50000 = binary .110000 ' -1 = binary .100000 ' since you want to represent +1 you need to scale back by just one count ' so scale_factor is ...
by Richard
Mar 12, 2007 21:43
Forum: General
Topic: hexadecimal
Replies: 13
Views: 1928

How you display your hex coefficients is probably determined by what you are going to do with them. Since you have a range of +/-1 you have a choice of signed or two's complement. If you consider the mantissa of a double it is probably a signed number with an unpredictable exponent. It gets a bit me...
by Richard
Mar 07, 2007 19:55
Forum: Documentation
Topic: Underscore rules
Replies: 3
Views: 2372

Yes, it does make sense which is why I tried it. The parser needs to know what to look for next. The Help on REM gives a new way of having comments that straddle multiple lines by using /' and '/ but this is a different situation since my example actually places the comments within the line of sourc...

Go to advanced search