diff --git a/docs/documentation/android/code_documentation/Vector3.md b/docs/documentation/android/code_documentation/Vector3.md new file mode 100644 index 0000000..978d17f --- /dev/null +++ b/docs/documentation/android/code_documentation/Vector3.md @@ -0,0 +1,87 @@ +# Vector3 + +This class represents a 3D vector with x, y, and z components. + +## public Vector3(double x, double y, double z) + +Constructor for creating a new vector. + +## public Vector3 copy() + +This method returns a new vector with the same values as the current vector. + +## public static Vector3 zero() + +This static method returns a new vector with all components set to zero. + +## public double magnitude(): double + +This method returns the magnitude of the vector. + +## public Vector3 normalize() + +This method returns the normalized vector. It throws an `IllegalArgumentException` if the vector is the zero vector. + +## public Vector3 subtract(Vector3 other) + +This method subtracts another vector from the current vector and returns the result as a new vector. + +## public Vector3 add(Vector3 other) + +This method adds another vector to the current vector and returns the result as a new vector. + +## public Vector3 multiply(double scalar) + +This method multiplies the vector by a scalar and returns the result as a new vector. + +## public Vector3 divide(double scalar) + +This method divides the vector by a scalar and returns the result as a new vector. It throws an `IllegalArgumentException` if the scalar is zero. + +## public Vector3 negate() + +This method negates the vector and returns the result as a new vector. + +## public Vector3 rotate(double radX, double radY, double radZ) + +This method rotates the vector around the X, Y, and Z axes by the specified angles in radians and returns the result as a new vector. + +## public Vector3 rotate(Vector3 rotation) + +This method rotates the vector around the X, Y, and Z axes. + +## public Vector3 rotateX(double angle) + +This method rotates the vector around the X axis by the specified angle in radians and returns the result as a new vector. + +## public Vector3 rotateY(double angle) + +This method rotates the vector around the Y axis by the specified angle in radians and returns the result as a new vector. + +## public Vector3 rotateZ(double angle) + +This method rotates the vector around the Z axis by the specified angle in radians and returns the result as a new vector. + +## public double distanceSq(Vector3 compare) + +This method returns the squared distance between the current vector and another vector. + +## public double distance(Vector3 compare) + +This method returns the distance between the current vector and another vector. + +## public double distanceToLine(Vector3 lineStart, Vector3 lineEnd) + +This method calculates the distance from the current vector to a line defined by two points and returns the result. + +## public Vector3 closest(Vector3 ... vectors) + +This method returns the closest vector to the current vector from a list of vectors. + +## public Vector3 map(VectorMapFunction function) + +This method applies a `VectorMapFunction` to the current vector and returns the result. + +## public String toString() + +This method returns a string representation of the vector. \ No newline at end of file diff --git a/docs/documentation/android/code_documentation/WebSocket.md b/docs/documentation/android/code_documentation/WebSocket.md new file mode 100644 index 0000000..95f574b --- /dev/null +++ b/docs/documentation/android/code_documentation/WebSocket.md @@ -0,0 +1,64 @@ +# WebSocket + +This class represents a WebSocket server. + +## private WebSocket() + +Constructor for creating a new WebSocket server. + +## public static WebSocket createServer() + +Function for creating a new WebSocket server. Due to Android security restrictions, +the server must be created both in a separate thread and with a non-predefined port. +The port will be selected by the system. + +## public void startListening() + +Method for listening for incoming connections. +This creates a new thread for the server. + +## public void stop() + +Method for stopping the WebSocket server. + +## public void setEventHandler(IWebSocketHandler handler) + +Method for setting the event handler for this WebSocket server. +This event handler accepts all WebSocket events, such as: +- onConnected(Socket socket) +- onMessageReceived(WebSocket.Message message, WebSocket.MessageReply replier) +- onDisconnected(Socket socket) +- onError(Socket socket, String error) + +## public ServerSocket getSocket() + +Method for getting the ServerSocket connection. + +## public boolean isConnected() + +Method for checking whether this WebSocket connection is connected. + +--- + +# WebSocket.Message + +Class representing a message received from a WebSocket connection. + +### Fields + +- `WebSocketConnection connection`: The connection from which the message was received. +- `String message`: The message content. + +## Opcode decode(byte opcode) + +Method for decoding the opcode of a message. + +## public Message(WebSocketConnection connection, String message) + +Constructor for a WebSocket message. + +# MessageReply + +Interface for a message reply. +This can be used for sending back a response to the client, by calling +`reply(String message)`. \ No newline at end of file