G'day Fair Strides,
Some sample input data, actual results and expected results would have helped.
A short script that reproduced your problem would have helped even more: we could have run it, tweaked it and suggested modifications.
The guidelines in "How do I post a question effectively?" explain how to do this.
"Here's the code I have for reading the info from a hash-of-hashes ..."
As I already alluded to, you provide no indication of the structure of this "hash-of-hashes" nor what data populates it.
In the code, you have variables with no indication of how they were declared or what values they might hold.
In order to troubleshoot this, we'd need to make many guesses regarding data, context and the value of variables: guessing is not a good way to proceed.
"and the code that takes the measure of degrees ..."
Much the same comments apply here also.
It looks like Tk code but you don't specify this.
It contains non-essential, distracting clutter like font families and sizes; but important information, such as variable declarations, is missing.
Here's a few comments on what you have provided:
-
Use the strict pragma in all your scripts; I do!
It will alert you to many little mistakes that you often won't notice: typos in variable names; missing or incorrect sigils; missing or duplicate declarations; and so on.
In the code you posted, there are multiple places where such alerts would be raised.
-
Use the warnings pragma in all your scripts; I do!
This will alert you to a huge number of potential problems.
I can see four places in your posted code where you'll not only receive a warning but also actual code to replace what you've written (e.g. "your_code" better written as "better_code").
-
Was there a reason you commented out "my $pi = 4*atan2(1,1)" and used a hard-coded value instead?
-
"# Read in from the Hash. The function that reads from the file returns an anon Array, so I have to access as a scalar, then turn it into an Array.":
Comments like this don't help at all!
There's no function, no file, no filehandle and an intermediary variable is unnecessary: just use my @arrayname = @{ expression_evaluating_to_arrayref };.
-
Learn about Slices.
Use @arrayname[@indexes] for an array slice and $arrayname[$single_index] for a single array element.
-
When you have an array and want to access single elements, just do it.
Don't assign array elements to $element1, $element2, ..., $elementN.
See also: Math::Trig (for pi constants and functions such as deg2rad); Math::Quaternion (for the creation and manipulation of quaternions); SecondLife::Rotation (for an example of how to subclass Math::Quaternion, should you need that).
"The game has a built-in scripting language, ..."
[The following (in the spoiler) has nothing at all to do with Perl; it's about NWScript.
Of interest to the OP, but of little or no interest to others.]
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.