# data[].attributes.body
#include<iostream>

#define USEMATH_DEFINES

#include<cmath>

#include"core.h"

using namespace cyclone;

int main() {

Vector3 A(1, 2, -1);

Vector3 B(3, 0, 2);

//0

A.normalise();

//1

B.normalise();

//2

Vector3 C = A.cross(B);

//3

if (C.magnitude() == 0)

{

std::cout << "a and b are parallel.\n";

}

else

{

C.normalise();

B = C.cross(A);

}

std::cout << "Orthonormal Basis Vectors:\n";

std::cout << "u1 = " << A.toString() << "\n";

std::cout << "u2 = " << B.toString() << "\n";

std::cout << "u3 = " << C.toString() << "\n";

return 0;

}

# data[].attributes.body
#define NOMINMAX

#define USEMATH_DEFINES

#include <iostream>

#include "core.h"

#include <cmath>

using namespace cyclone;

int main() {

Vector3 A(1, 2, -1);

Vector3 B(3, 0, 2);

A.normalise();

B.normalise();

Vector3 C = A.cross(B);

if (C.magnitude() == 0)

std::cout << "a and b are parallel" << std::endl;

else {

C.normalise();

B = C.cross(A);

}

std::cout << "orthonormal basis" << std::endl;

std::cout << "O1: " << A.x << " " << A.y << " " << A.z << std::endl;

std::cout << "O2: " << B.x << " " << B.y << " " << B.z << std::endl;

std::cout << "O3: " << C.x << " " << C.y << " " << C.z << std::endl;

}

# data[].attributes.body
#include <iostream>

#define USEMATH_DEFINES
        #include <cmath>

#include "core.h"

static cyclone::Vector3 Project(const cyclone::Vector3 &a, const cyclone::Vector3 &b)
{
	return (a.dot(b) / a.dot(a)) * a;
}

int main()
{
	cyclone::Vector3 A(1, 2, -1);
	cyclone::Vector3 B(3, 0, 2);

	A.normalise();

	cyclone::Vector3 u2 = B - Project(A, B);

	u2.normalise();

	cyclone::Vector3 u3 = A.cross(u2);

	std::cout << "Orthogonal Basis :\n";
	std::cout << "u1 = " << A.toString()  << std::endl;
	std::cout << "u2 = " << u2.toString() << std::endl;
	std::cout << "u3 = " << u3.toString() << std::endl;

    return 0;
}

# data[].attributes.body
#define NOMINMAX

#include <iostream>

#define USEMATH_DEFINES

#include "core.h"

int main() {

cyclone::Vector3 A{ 1, 2, -1 };

cyclone::Vector3 B{ 3, 0, 2 };

A.normalise();

B.normalise();

cyclone::Vector3 C{ A.cross(B) };

C.normalise();

B = C.cross(A);

std::cout << "A: " << A.toString() << std::endl;

std::cout << "B: " << B.toString() << std::endl;

std::cout << "C: " << C.toString() << std::endl;

return 0;

}

# data[].attributes.body
#define NOMINMAX
#include <iostream>
#include "core.h"

int main()
{
	cyclone::Vector3 e1(1, 2, -1);
	cyclone::Vector3 e2(3, 0, 2);

	e1.normalise();
	e2.normalise();
	cyclone::Vector3 e3 = e1.cross(e2);

	if (e3.magnitude() != 0) {
		e3.normalise();
		e2 = e3.cross(e1);
	}

	std::cout << "Orthonormal Basis :" << std::endl;
	std::cout << "e1:" << e1.toString() << std::endl;
	std::cout << "e2:" << e2.toString() << std::endl;
	std::cout << "e3:" << e3.toString() << std::endl;
}

# data[].attributes.body
#include <iostream>
#include "core.h"

int main()
{
    cyclone::Vector3 A(1, 2, -1);
    cyclone::Vector3 B(3, 0, 2);

    A.normalise();

    cyclone::Vector3 ob2 = (B - (A.dot(B) / A.dot(A)) * A);
    ob2.normalise();

    cyclone::Vector3 ob3 = A.cross(ob2);
    ob3.normalise();

    std::cout << "ob1 = " << A.toString() << std::endl;
    std::cout << "ob2 = " << ob2.toString() << std::endl;
    std::cout << "ob3 = " << ob3.toString() << std::endl;
    return 0;
}

# data[].attributes.body
#include <algorithm>
#include <chrono>
#include <cmath>
#include <iostream>
#include <ranges>
#include <type_traits>

#define NOMINMAX
#include "core.h"
#include <iostream>

using vec3 = cyclone::Vector3;

void printBasis(vec3 a, vec3 b) {
  a.normalize();
  b.normalize();
  vec3 c = a.cross(b);
  c.normalize();
  if (c.magnitude() == 0) {
    std::cout << "a and b are parallel" << std::endl;
    return;
  }
  b = c.cross(a);

  std::cout << "basis is : " << std::endl;
  std::cout << a.toString() << ", " << b.toString() << ", " << c.toString()
            << std::endl;
}

int main() {

  const double DEGREES_TO_RADIAN = M_PI / 180.0f;
  const double RADIAN_TO_DEGREES = 180.0f / M_PI;
  vec3 a(1, 2, -1);
  vec3 b(3, 0, 2);
  printBasis(a, b);
}

# data[].attributes.body
#define NOMINMAX

#include <iostream>

#define USEMATH_DEFINES

#include <cmath>

#include "core.h"

int main()

{

cyclone::Vector3 a(1, 2, -1);

cyclone::Vector3 b(3, 0, 2);

a.normalise();

b.normalise();

cyclone::Vector3 c = a.cross(b);

if (c.magnitude() != 0) {

c.normalise();

b = c.cross(a);

}

std::cout << "Orthonormal basis" << std::endl;

std::cout << "a: " << a.toString() << std::endl;

std::cout << "b: " << b.toString() << std::endl;

std::cout << "c: " << c.toString() << std::endl;

}

# data[].attributes.body
#define NOMINMAX

#include <iostream>

#include "core.h"

int main()

{

cyclone::Vector3 A(1, 2, -1);

cyclone::Vector3 B(3, 0, 2);

cyclone::Vector3 u1 = A.unit();

cyclone::Vector3 projB_on_u1 = u1 * (B.dot(u1));

cyclone::Vector3 u2 = (B - projB_on_u1).unit();

cyclone::Vector3 u3 = u1.cross(u2).unit();

std::cout << "Orthonormal basis vectors:" << std::endl;

std::cout << "u1: (" << u1.x << ", " << u1.y << ", " << u1.z << ")" << std::endl;

std::cout << "u2: (" << u2.x << ", " << u2.y << ", " << u2.z << ")" << std::endl;

std::cout << "u3: (" << u3.x << ", " << u3.y << ", " << u3.z << ")" << std::endl;

return 0;

}

# data[].attributes.body
#define NOMINMAX
#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>

#include "core.h"

const double DEGREES_TO_RADIANS = M_PI / 180.0f;
const double RADIANS_TO_DEGREES = 180.0f / M_PI;

int main()
{
	cyclone::Vector3 a(1, 2, -1);
	cyclone::Vector3 b(3, 0, 2);
	a.normalise();
	b.normalise();

	std::cout << "Orthonormal basis:" << std::endl;

	cyclone::Vector3 c = a.cross(b);

	if (c.magnitude() != 0) {
		c.normalise();
		b = c.cross(a);
		std::cout << "a: " << a.toString() << std::endl;
		std::cout << "b: " << b.toString() << std::endl;
		std::cout << "c: " << c.toString() << std::endl;
	}
	else {
		std::cout << "Vector A and B are parallel" << std::endl;
		std::cout << "a: " << a.toString() << std::endl;
		std::cout << "b: " << b.toString() << std::endl;
	}

   return 0;
}

# data[].attributes.body
#define NOMINMAX

#define USEMATH_DEFINES

#include <iostream>

#include "core.h"

#include <cmath>

int main()

{

cyclone::Vector3 A(1, 2, -1);

cyclone::Vector3 B(3, 0, 2);

A.normalise();

B.normalise();

cyclone::Vector3 C = A.cross(B);

if (C.magnitude() != 0) {

C.normalise();

B = C.cross(A);

}

std::cout << "Orthonormal:" << std::endl;

std::cout << "A:" << A.toString() << std::endl;

std::cout << "B:" << B.toString() << std::endl;

std::cout << "C:" << C.toString() << std::endl;

}

# data[].attributes.body
#include "core.h"

#include <iostream>

int main()

{

cyclone::Vector3 a(1, 2, -1); // fixed

cyclone::Vector3 b(3, 0, 2);

a.normalise();

b.normalise();

cyclone::Vector3 c = a % b;

if (c.magnitude() == 0) {

std::cout << "a and b are parallel" << std::endl;

} else {

c.normalise();

b = c % a;

std::cout << "a: " << a.toString() << std::endl;

std::cout << "b: " << b.toString() << std::endl;

std::cout << "c: " << c.toString() << std::endl;

}

}

# data[].attributes.body
//#define NOMINMAX

#define USEMATH_DEFINES

#include <iostream>

#include <cmath>

#include "core.h"

int main()

{

cyclone::Vector3 A, B, C;

A = cyclone::Vector3(1, 2, -1);

B = cyclone::Vector3(3, 0, 2);

A.normalise();

B.normalise();

C = A.cross(B);

if (C.magnitude() != 0) {

C.normalise();

B = C.cross(A);

std::cout << "Orthonormal :" << std::endl;

std::cout << "A: " << A.toString() << std::endl;

std::cout << "B: " << B.toString() << std::endl;

std::cout << "C: " << C.toString() << std::endl;

} else {

std::cout << "Vectors are parallel" << std::endl;

}

return 0;

}

# data[].attributes.body
Vector3 ProjectVector(const Vector3 &a, const Vector3 &b)
{
   return a.dot(b) / a.dot(a) * a;
}

void SecondClassTests()
{
   Vector3 u1(1, 2, -1);
   Vector3 b(3, 0, 2);

   u1.normalise();

   Vector3 u2 = b - ProjectVector(u1, b);

   u2.normalise();

   const Vector3 u3 = u1.cross(u2);

   std::cout << "u1 = " << u1.toString()  << std::endl;
   std::cout << "u2 = " << u2.toString() << std::endl;
   std::cout << "u3 = " << u3.toString() << std::endl;
}

# data[].attributes.body
#define NOMINMAX

#include <iostream>

#include "core.h"

int main()

{

cyclone::Vector3 a(1, 2, -1);

cyclone::Vector3 b(3, 0, 2);

a.normalise();

b.normalise();

cyclone::Vector3 c = a.cross(b);

if (c.magnitude() == 0) {

std::cout << "Vectors are parallel" << std::endl;

return 0;

} else {

c.normalise();

b = c.cross(a);

}

std::cout << "a: " << a.toString() << std::endl;

std::cout << "b: " << b.toString() << std::endl;

std::cout << "c: " << c.toString() << std::endl;

return 0;

}

# data[].attributes.body
#define NOMINMAX

#include <iostream>

#include "core.h"

int main()

{

cyclone::Vector3 u(1, 2, -1);

cyclone::Vector3 v(3, 0, 2);

u.normalise();

v.normalise();

cyclone::Vector3 w = u.cross(v);

if (w.magnitude() > 0) {

w.normalise();

v = w.cross(u);

}

std::cout << "Orthonormal Basis:" << std::endl;

std::cout << "u: " << u.toString() << std::endl;

std::cout << "v: " << v.toString() << std::endl;

std::cout << "w: " << w.toString() << std::endl;

return 0;

}

# data[].attributes.body
#define NOMINMAX

#include <iostream>

#define USEMATH_DEFINES

#include "core.h"

int main()

{

cyclone::Vector3 a{1, 2, -1};

cyclone::Vector3 b{3, 0, 2};

a.normalise();

b.normalise();

cyclone::Vector3 c{ a.cross(b) };

if (c.magnitude() == 0)

std::cout << "a & b are parallel\n";

else {

c.normalise();

b = c.cross(a);

}

std::cout << "a: " << a.toString() << '\n';

std::cout << "b: " << b.toString() << '\n';

std::cout << "c: " << c.toString() << '\n';

return 0;

}

# data[].attributes.body
#define NOMINMAX
#define _USE_MATH_DEFINES
#include <iostream>
#include "core.h"
#include <cmath>

int main()
{
	cyclone::Vector3 a(1, 2, -1);
	cyclone::Vector3 b(3, 0, 2);

	a.normalise();
	b.normalise();

	cyclone::Vector3 c = a.cross(b);

	if (c.magnitude() != 0)
	{
		c.normalise();
		b = c.cross(a);
	}

	std::cout << a.toString() << std::endl;
	std::cout << b.toString() << std::endl;
	std::cout << c.toString() << std::endl;
	return 0;
}

# data[].attributes.body
int main()

{

	const double RADIANS_TO_DEGREES = 180.0f / R_PI;

	const double DEGREES_TO_RADIANS = R_PI / 180.0f;

	Vector3 A(1, 2, -1);

	Vector3 B(3, 0, 2);

	A.normalise();

	B.normalise();

	Vector3 C = A.cross(B);

	C.normalise();

	B = C.cross(A);

	std::cout << "A: " << A.toString() << "\nB: " << B.toString() << "\nC: " << C.toString() << std::endl;

	return 0;

};

# data[].attributes.body
#include <iostream>
#include "core.h"

int main() {
    cyclone::Vector3 a(1, 2, -1);
    cyclone::Vector3 b(3, 0, 2);

    a.normalise();
    b.normalise();

    cyclone::Vector3 c = a.cross(b);

    if (c.magnitude() == 0) {
        std::cout << "Vector a and vector b are parallel, cannot form an orthonormal basis." << std::endl;
        return 1;
    } else {
        c.normalise();
        b = c.cross(a);
    }

    std::cout << "a: (" << a.x << ", " << a.y << ", " << a.z << ")" << std::endl;
    std::cout << "b: (" << b.x << ", " << b.y << ", " << b.z << ")" << std::endl;
    std::cout << "c: (" << c.x << ", " << c.y << ", " << c.z << ")" << std::endl;

    return 0;
}

# data[].attributes.body
#define NOMINMAX
#include <iostream>
#include "core.h"
#include <cmath>

int main()
{
	cyclone::Vector3 a(1, 2, -1);
	cyclone::Vector3 b(3, 0, 2);
	b.normalise();
	a.normalise();
	cyclone::Vector3 c = a.cross(b);
	if (c.magnitude() == 0)
		std::cout << "Result: " << "Parallel" << std::endl;
	else {
		c.normalise();
		b = c.cross(a);
		std::cout << "A: " << a.toString() << std::endl;
		std::cout << "B: " << b.toString() << std::endl;
		std::cout << "C: " << c.toString() << std::endl;
	}
   return 0;
}

# data[].attributes.body
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <cyclone/cyclone.h>

using namespace cyclone;

int main()
{
    Vector3 A(1, 2, -1);
    Vector3 B(3, 0, 2);

    Vector3 e1 = A;
    e1.normalise();

    Vector3 proj_A_B = e1 * (B.scalarProduct(e1));
    Vector3 v2 = B - proj_A_B;

    Vector3 e2 = v2;
    e2.normalise();

    Vector3 e3 = e1.vectorProduct(e2);
    e3.normalise();

    std::cout << "e1: (" << e1.x << ", " << e1.y << ", " << e1.z << ")" << std::endl;
    std::cout << "e2: (" << e2.x << ", " << e2.y << ", " << e2.z << ")" << std::endl;
    std::cout << "e3: (" << e3.x << ", " << e3.y << ", " << e3.z << ")" << std::endl;

    return 0;
}

# data[].attributes.body
#define NOMINMAX
#include <iostream>
#include "core.h"

int main() {
	cyclone::Vector3 a = cyclone::Vector3(1, 2, -1).unit();
	cyclone::Vector3 b = cyclone::Vector3(3, 0, 2).unit();
	cyclone::Vector3 c = a.cross(b).unit();
	if (c.magnitude() == 0)
		std::cout << "Collinear" << std::endl;
	else {
		b = c.cross(a);
		std::cout << a.toString() << std::endl;
		std::cout << b.toString() << std::endl;
		std::cout << c.toString() << std::endl;
	}
	return 0;
}

# data[].attributes.body
#define NOMINMAX
#include <iostream>
#include "core.h"

int main()
{
	cyclone::Vector3 a(1, 2, -1);
	cyclone::Vector3 b(3, 0, 2);

	a.normalise();
	b.normalise();
	cyclone::Vector3 c = a.cross(b);

	if (c.magnitude() != 0) {
		c.normalise();
		b = c.cross(a);
	}

	std::cout << "u1: " << a.toString() << std::endl;
	std::cout << "u2: " << b.toString() << std::endl;
	std::cout << "u3: " << c.toString() << std::endl;
	return 0;
}

# data[].attributes.body
#define NOMINMAX

#define USEMATH_DEFINES

#include <iostream>

#include <cmath>

#include "core.h"

int main()

{

cyclone::Vector3 A, B, C;

A = cyclone::Vector3(1, 2, -1);

B = cyclone::Vector3(3, 0, 2);

A.normalise();

B.normalise();

C = A.cross(B);

if (C.magnitude() != 0) {

C.normalise();

B = C.cross(A);

std::cout << "Orthonormal :" << std::endl;

std::cout << "A: " << A.toString() << std::endl;

std::cout << "B: " << B.toString() << std::endl;

std::cout << "C: " << C.toString() << std::endl;

}

else {

std::cout << "Vectors are parallel" << std::endl;

}

return 0;

}

# data[].attributes.body
#define NOMINMAX
#include <iostream>
#include "core.h"
#include <cmath>
#define _USE_MATH_DEFINES

int main()
{
	cyclone::Vector3 a(1, 2, -1);
	cyclone::Vector3 b(3, 0, 2);

	a.normalise();
	b.normalise();
	cyclone::Vector3 c = a.cross(b);
	if (c.magnitude() == 0) {}
	else {
		c.normalise();
		b = a % b;
	}
	std::cout << "a, b, c" << std::endl << a.toString() << std::endl << b.toString() << std::endl << c.toString() << std::endl;
}

# data[].attributes.body
#include <iostream>
#include "core.h"

int main()
{
   cyclone::Vector3 a(1, 2, -1);
   cyclone::Vector3 b(3, 0, 2);

   a.normalise();
   b.normalise();

   cyclone::Vector3 c = a.cross(b);

   if (c.squareMagnitude()) {
      c.normalise();
      b = c.cross(a);
   }

   std::cout << a.toString() << std::endl;
   std::cout << b.toString() << std::endl;
   std::cout << c.toString() << std::endl;

   return 0;
}