fluffos/docs/efun/general/angle.md
gesslar 6e6d1c772b
docs: flesh out 31 TBW efun reference pages (#1248)
* empty

* docs: flesh out 31 TBW efun reference pages

Replace the placeholder "TBW" DESCRIPTION and type-only SYNOPSIS in 31
efun docs with real descriptions and named parameters, verified against
the driver source:

- math (general/): log10, log2, norm, dotprod, distance, angle
- matrix (general/): id_matrix, translate, scale, rotate_x/y/z,
  lookat_rotate, lookat_rotate2 -- note the in-place mutation of the
  passed matrix and that rotations are in degrees
- compress (general/): compress, uncompress, compress_file,
  uncompress_file -- note the file variants delete the source on success
- interactive/: send_zmp, act_mxp, request_term_type,
  start_request_term_type, request_term_size
- internals/: dump_trace, destructed_objects, check_memory (flag
  bitmask + DEBUGMALLOC build requirement), dump_stralloc, dump_jemalloc
- core: next_bit, explode_reversible, shallow_inherit_list

Each page keeps the existing manpage-style layout (4-space-indented
NAME/SYNOPSIS/DESCRIPTION, name(3) SEE ALSO). Example blocks are indented
to match, so all files are markdownlint-clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 22:07:47 -04:00

839 B

title
general / angle

angle

NAME

angle() - the angle between two vectors, in radians

SYNOPSIS

float angle(int * | float * vector_a, int * | float * vector_b)

DESCRIPTION

Returns the angle between 'vector_a' and 'vector_b', expressed in radians.
It is computed as acos(dotprod(a, b) / (norm(a) * norm(b))). The result is
always a float.

Both vectors must have the same size; otherwise a runtime error is raised
("angle: cannot calculate the angle between vectors of different sizes.").
Each element may independently be an int or a float; an element of any
other type raises a runtime error.

EXAMPLE

angle(({ 1, 0 }), ({ 0, 1 })); // 1.5707963...  (pi/2, a right angle)
angle(({ 1, 0 }), ({ 1, 0 })); // 0.0

SEE ALSO

norm(3), dotprod(3), distance(3)