Search found 2898 matches

by Richard
Apr 26, 2007 16:24
Forum: General
Topic: Polygon Challenge
Replies: 26
Views: 4239

I have edited my code and documentation to fix and clean it up a bit. It also now plots the polygons. I would first like to thank duke4e and Sisophon2001 for their praise. Secondly I would not have done it if such an apparently simple problem had not been posed clearly. Luckily I needed something to...
by Richard
Apr 25, 2007 13:03
Forum: General
Topic: Polygon Challenge
Replies: 26
Views: 4239

The problem is soluble. By selecting a vector method and avoiding triangulation the solution is fairly simple, just lots of clear thinking. This method here solves the problem. It ignores the empty area in the top polygon while connecting the two separate areas below with a zero width channel. Anyho...
by Richard
Apr 25, 2007 3:31
Forum: Beginners
Topic: Declare Function with passed array
Replies: 8
Views: 1475

D.J.Peters, Thanks for that. To put the empty brackets in to specify an array needs any dummy variable name. The word array seems to work and makes the meaning obvious.
So simple.

Code: Select all

Declare Function two( As Integer, array() As Double) As Double
by Richard
Apr 25, 2007 3:02
Forum: Beginners
Topic: Declare Function with passed array
Replies: 8
Views: 1475

Declare Function with passed array

I am having trouble finding out how to write a "Declare Function" statement that specifies an array as a passed parameter. The following code runs ok but if I uncomment the "Declare Function two(... " line it gives me "error 55, type missmatch" at the "Function two(..." line later on. How should I w...
by Richard
Apr 20, 2007 3:01
Forum: General
Topic: Image Rotation
Replies: 7
Views: 2103

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: 2103

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: 1686

@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: 1686

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: 4239

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: 2388

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: 2388

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: 865

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: 3712

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: 3712

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: 3712

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...

Go to advanced search