Difference between revisions of "COS.DAT"

From UFOpaedia
Jump to navigation Jump to search
m
 
Line 24: Line 24:
 
* [[Saved Game Files]]
 
* [[Saved Game Files]]
 
[[Category:Game Files]]
 
[[Category:Game Files]]
  +
[[Category:Enemy Unknown/UFO Defense]]

Latest revision as of 14:39, 23 July 2013

Plotting of COS values.
Plotting of SINE values.

Zaimoni: some working notes

These are precomputed cosine values. The complete prime factorization of the file size 5762 is 2·2881.

The values are represented as scaled signed 2-byte integers representing floating-point numbers in the range 0 to 1, scaling factor 210 i.e. 1024. First and last values are identical, so it is simplest to assume there are 2880 distinct reference values here. Brute verification was conducted by Python script for all angles, that are a multiple of 1/8th of a degree, from 0° to 45° inclusive...exact match.

The intent appears to be to enumerate a full circle.

SIN.DAT is the same format, but holds precomputed sine values.

The following trigonometric identities are satisfied exactly when the period is taken to be 2880, and the indexing units are taken to be eighths of a degree (observe that 2880=360·8):

  • half-circle identity
  • supplementary function identity
  • cofunction identity
  • cosine even function, sin odd function identities

The above trigonometric identities extend the brute verification to the whole file. We may tentatively assume that the game uses 2880 units to a circle.

See Also