Skip to content

Instantly share code, notes, and snippets.

Avatar
🇷🇺

Maxim Timakov max-dark

🇷🇺
View GitHub Profile
@nnaumenko
nnaumenko / mc7.md
Last active Jul 11, 2021
Simatic MC7 code
View mc7.md
@gszauer
gszauer / raw_quat.cpp
Last active Apr 5, 2021
Simple Quaternions
View raw_quat.cpp
#include <iostream>
#include <cmath>
using std::cout;
typedef struct quat_t {
double w, x, y, z;
} quat, quaternion;
typedef struct euler_t {
View Quaternion Cpp
#include "Quaternion.h"
#include <cmath>
// http://content.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation
// http://www.flipcode.com/documents/matrfaq.html
// http://db-in.com/blog/2011/04/cameras-on-opengl-es-2-x/
// http://wiki.beyondunreal.com/Legacy:Quaternion
// http://clb.demon.fi/MathGeoLib/docs/float3x3.cpp_code.html#612
// http://clb.demon.fi/MathGeoLib/docs/Quat_summary.php
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
View Vector Cpp
#include "Vector.h"
#include <cmath>
const Vector Vector::zero(0.0f, 0.0f, 0.0f);
const Vector Vector::one(1.0f, 1.0f, 1.0f);
const Vector Vector::forward(0.0f, 0.0f, 1.0f);
const Vector Vector::up(0.0f, 1.0f, 0.0f);
const Vector Vector::right(1.0f, 0.0f, 0.0f);
Vector::Vector(float X, float Y, float Z) : x(X), y(Y), z(Z), w(0.0f) {}
View Matrix Cpp
#include "Matrix.h"
#include <string.h>
#include <cmath>
#define MATRIXELEMENT(mat, row, col) mat[row * 4 + col]
const Matrix Matrix::zero;
const Matrix Matrix::identity(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f );
Matrix::Matrix() {
@jzrake
jzrake / Makefile
Created Apr 17, 2012
Wrapping C++ classes with Lua
View Makefile
LUAHOME = $(HOME)/Work/lunum/lua-5.2.0
CFLAGS = -Wall
default : luawrap
luawrap : luawrap.cpp
$(CXX) $(CFLAGS) -o $@ $^ -L$(LUAHOME)/lib -I$(LUAHOME)/include -llua
clean :