From 39e3f877a995d8fd0adb748ace5cfd5b2f40854b Mon Sep 17 00:00:00 2001 From: ffrostfall <80861876+ffrostflame@users.noreply.github.com> Date: Mon, 13 May 2024 18:21:43 -0400 Subject: [PATCH] Additional functions, primitive type, constants --- docs/vector-library.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/vector-library.md b/docs/vector-library.md index c1186e6..19d0108 100644 --- a/docs/vector-library.md +++ b/docs/vector-library.md @@ -40,6 +40,36 @@ Returns the cross product of two vectors. Returns the dot product of two vectors. +`vector.floor(vec: vector)` + +Equivalent of `math.floor` for vectors. + +`vector.ceil(vec: vector)` + +Equivalent of `math.ceil` for vectors. + +`vector.angle(vecA: vector, vecB: vector)` + +Returns the angle between two vectors. + +`vector.max(input: vector, maximum: vector)` + +Equivalent of `math.max` for vectors. + +`vector.min(input: vector, minimum: vector)` + +Equivalent of `math.min` for vectors. + +--- + +`vector.zero` + +Vector where `x=0, y=0, z=0, w?=0` + +`vector.one` + +Vector where `x=1, y=1, z=1, w?=1` + --- ### Arithmetic operations @@ -54,6 +84,10 @@ In the future, vectors will have special treatment in native codegen. This creat Currently, there are 2 compiler options relating to vectors, `vectorLib` & `vectorCtor`. This poses an interesting problem: a builtin library would remove the _requirement_ for such compiler options, however these options still need to be supported. The intuitive solution to this is to leave both compiler options working and maintained, but provide the built-in vector library by default, allowing two vector libraries and two vector constructors. +### Typechecking + +A new primitive `vector` type should be added to the type system. + ## Drawbacks As per all additional globals, this creates a new global `vector`. This is a commonly used variable name, and many style guides will advise to avoid using `vector` as a variable name due to the global being added.