using System.Collections.Generic;
public struct Vector<T> {
public Vector(int size) {
set => Values[i] = value;
public T Dot(Vector<T> r) {
for(int i = 0; i < Size; i++) {
result += (dynamic) Values[i] * r[i];
public Vector<T> Min(Vector<T> r) {
Vector<T> result = new Vector<T>(Size);
for(int i = 0; i < Size; i++) {
result[i] = (dynamic) Values[i] < r[i] ? Values[i] : r[i];
for(int i = 0; i < Size; i++) {
if((dynamic) Values[i] < minValue) {
public Vector<T> Max(Vector<T> r) {
Vector<T> result = new Vector<T>(Size);
for(int i = 0; i < Size; i++) {
result[i] = (dynamic) Values[i] > r[i] ? Values[i] : r[i];
for(int i = 0; i < Size; i++) {
if((dynamic) Values[i] > maxValue) {
public T LengthSquared() {
return MathF.Sqrt((dynamic) LengthSquared());
public Vector<T> Normalized() {
public Vector<T> Lerp(Vector<T> r, T lerpFactor) {
return (r - this) * lerpFactor + this;
public static Vector<T> operator +(Vector<T> a, Vector<T> b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] + b[i];
public static Vector<T> operator +(Vector<T> a, T b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] + b;
public static Vector<T> operator -(Vector<T> a, Vector<T> b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] - b[i];
public static Vector<T> operator -(Vector<T> a, T b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] - b;
public static Vector<T> operator *(Vector<T> a, Vector<T> b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] * b[i];
public static Vector<T> operator *(Vector<T> a, T b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] * b;
public static Vector<T> operator /(Vector<T> a, Vector<T> b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] / b[i];
public static Vector<T> operator /(Vector<T> a, T b) {
Vector<T> result = new Vector<T>(a.Size);
for(int i = 0; i < a.Size; i++) {
result[i] = (dynamic) a[i] / b;