Skip to content

Commit

Permalink
Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1maker committed Dec 7, 2024
1 parent e1b3170 commit ef268b2
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 13 deletions.
110 changes: 97 additions & 13 deletions docs/Foundation/Namespaces/Global/Classes/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,109 @@

The `vector` class provides a data structure for representing and manipulating 3D vectors in NGT. It supports basic operations such as assigning values, resetting the vector, and accessing its components.

## Constructors

### `vector()`
- **Description**: Constructs an empty 3D vector with all components set to zero.
- **Return Type**: void
- **Description**: Constructs a new vector object. The default constructor initializes the vector to zero.

## Methods
### `vector(const vector&in)`
- **Return Type**: void
- **Description**: Constructs a new vector as a copy of another vector.

### `float get_length() const property`
- **Return Type**: float
- **Description**: Returns the length (magnitude) of the 3D vector as a property.
### `vector(float, float = 0, float = 0)`
- **Return Type**: void
- **Description**: Constructs a new vector with the specified x, y, and z components. If y and z are not provided, they default to zero.

### `vector& opAddAssign(const vector&in)`
- **Return Type**: vector&
- **Description**: Adds another vector to this vector in-place and returns a reference to this vector.

### `vector& opSubAssign(const vector&in)`
- **Return Type**: vector&
- **Description**: Subtracts another vector from this vector in-place and returns a reference to this vector.

### `vector& opMulAssign(float)`
- **Return Type**: vector&
- **Description**: Multiplies each component of this vector by the specified scalar value in-place and returns a reference to this vector.

### `vector& opAssign(const vector&in other)`
- **Parameters**:
- `other` (const vector&): The other vector to assign.
### `vector& opDivAssign(float)`
- **Return Type**: vector&
- **Description**: Assigns the contents of another vector to this one and returns a reference to this object.
- **Description**: Divides each component of this vector by the specified scalar value in-place and returns a reference to this vector.

### `bool opEquals(const vector&in) const`
- **Return Type**: bool
- **Description**: Compares two vectors for equality. Returns true if all corresponding components are equal; otherwise, returns false.

### `vector opAdd(const vector&in) const`
- **Return Type**: vector
- **Description**: Adds another vector to this vector and returns a new vector containing the result.

### `vector opSub(const vector&in) const`
- **Return Type**: vector
- **Description**: Subtracts another vector from this vector and returns a new vector containing the result.

### `vector opMul(float) const`
- **Return Type**: vector
- **Description**: Multiplies each component of this vector by the specified scalar value and returns a new vector containing the result.

### `vector opMul_r(float) const`
- **Return Type**: vector
- **Description**: Multiplies each component of the specified vector by the scalar value and returns a new vector containing the result (right-hand side multiplication).

### `vector opDiv(float) const`
- **Return Type**: vector
- **Description**: Divides each component of this vector by the specified scalar value and returns a new vector containing the result.

### `float length() const`
- **Return Type**: float
- **Description**: Calculates and returns the length (magnitude) of the vector.

### `vector get_xyz() const`
- **Return Type**: vector
- **Description**: Returns a new vector with components rearranged to x, y, z order.

### `vector get_yzx() const`
- **Return Type**: vector
- **Description**: Returns a new vector with components rearranged to y, z, x order.

### `vector get_zxy() const`
- **Return Type**: vector
- **Description**: Returns a new vector with components rearranged to z, x, y order.

### `vector get_zyx() const`
- **Return Type**: vector
- **Description**: Returns a new vector with components rearranged to z, y, x order.

### `vector get_yxz() const`
- **Return Type**: vector
- **Description**: Returns a new vector with components rearranged to y, x, z order.

### `vector get_xzy() const`
- **Return Type**: vector
- **Description**: Returns a new vector with components rearranged to x, z, y order.

### `void set_xyz(const vector&in)`
- **Return Type**: void
- **Description**: Sets the components of this vector to those of another vector in the x, y, z order.

### `void set_yzx(const vector&in)`
- **Return Type**: void
- **Description**: Sets the components of this vector to those of another vector in the y, z, x order.

### `void set_zxy(const vector&in)`
- **Return Type**: void
- **Description**: Sets the components of this vector to those of another vector in the z, x, y order.

### `void set_zyx(const vector&in)`
- **Return Type**: void
- **Description**: Sets the components of this vector to those of another vector in the z, y, x order.

### `void set_yxz(const vector&in)`
- **Return Type**: void
- **Description**: Sets the components of this vector to those of another vector in the y, x, z order.

### `void reset() const`
- **Description**: Resets all components of the vector to zero.
### `void set_xzy(const vector&in)`
- **Return Type**: void
- **Description**: Sets the components of this vector to those of another vector in the x, z, y order.

## Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
- `retcode` (int): The return code to use when exiting the application.
- **Description**: Exits the application with the specified return code.

### `void abort()`
- **Return Type**: void
- **Description**: Terminates the current program immediately. The exact behavior of this function may vary depending on the implementation and platform, but it typically causes an abnormal termination with no normal cleanup. This function is often used in cases where a fatal error occurs that makes continued execution impossible or unsafe.

### `bool get_quit_requested() property`
- **Return Type**: bool
- **Description**: Gets a flag indicating whether the quit operation has been requested as a property.
Expand Down

0 comments on commit ef268b2

Please sign in to comment.