<commit_before>/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   vml.h                                              :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: gpinchon <<EMAIL>>          +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2016/10/12 17:13:36 by gpinchon          #+#    #+#             */
/*   Updated: 2017/01/07 16:34:02 by gpinchon         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef VML_H
# define VML_H

# include <math.h>
# define VEC2			struct s_vec2
# define VEC3			struct s_vec3
# define VEC4			struct s_vec4
# define MAT2			struct s_mat2
# define MAT3			struct s_mat3
# define MAT4			struct s_mat4
# define RAY			struct s_ray
# define INTERSECT		struct s_intersect
# define PRIMITIVE		struct s_primitive
# define TRANSFORM		struct s_transform
# define OBJ			union u_obj
# define VMLBOOL		enum e_vmlbool
# define FRUSTUM		VEC4
# define FLOAT_ZERO		1E-6
# define DOUBLE_ZERO	1E-6
# define PRIM_TYPE		enum e_prim_type
# define TO_RADIAN(x)	(x * 0.01745329251994329576923690768489f)
# define STEP(a, x)		(x >= a)
# define CLAMP(nbr, min, max)	(nbr <= min ? min : nbr >= max ? max : nbr)
# define CYCLE(nbr, min, max)	(nbr >= min ? max : nbr <= max ? min : nbr)

enum			e_vmlbool
{
	vmlfalse = 0,
	vmltrue = !vmlfalse
};

typedef struct	s_vec2
{
	float		x;
	float		y;
}				t_vec2;

typedef struct	s_vec3
{
	float		x;
	float		y;
	float		z;
}				t_vec3;

typedef struct	s_vec4
{
	float		x;
	float		y;
	float		z;
	float		w;
}				t_vec4;

typedef struct	s_mat2
{
	float		m[4];
}				t_mat2;

typedef struct	s_mat3
{
	float		m[9];
}				t_mat3;

typedef struct	s_mat4
{
	float		m[16];
}				t_mat4;

typedef struct	s_transform
{
	VMLBOOL		updated;
	VEC3		position;
	VEC3		rotation;
	VEC3		scaling;
	VEC3		up;
	MAT4		transform;
	MAT4		translate;
	MAT4		rotate;
	MAT4		scale;
}				t_transform;

enum e_prim_type
{
	sphere = 0x1,
	plane = 0x2,
	cylinder = 0x3,
	capped_cylinder = 0x4,
	cone = 0x5,
	capped_cone = 0x6,
	triangle = 0x7,
	disc = 0x8
};

typedef struct	s_sphere
{
	float		radius;
	float		radius2;
}				t_sphere;

typedef struct	s_plane
{
}				t_plane;

typedef struct	s_disc
{
	float		radius;
	float		radius2;
}				t_disc;

typedef struct	s_cylinder
{
	float		radius;
	float		radius2;
	float		size;
}				t_cylinder;

typedef struct	s_cone
{
	float		radius;
	float		radius2;
	float		size;
}				t_cone;

typedef struct	s_triangle
{
	VEC3		point[3];
	VEC3		normal[3];
}				t_triangle;

typedef union	u_obj
{
	t_sphere	sphere;
	t_plane		plane;
	t_cylinder	cylinder;<commit_msg>removed normal[3] from triangle type<commit_after>/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   vml.h                                              :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: gpinchon <<EMAIL>>          +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2016/10/12 17:13:36 by gpinchon          #+#    #+#             */
/*   Updated: 2017/01/07 16:34:02 by gpinchon         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef VML_H
# define VML_H

# include <math.h>
# define VEC2			struct s_vec2
# define VEC3			struct s_vec3
# define VEC4			struct s_vec4
# define MAT2			struct s_mat2
# define MAT3			struct s_mat3
# define MAT4			struct s_mat4
# define RAY			struct s_ray
# define INTERSECT		struct s_intersect
# define PRIMITIVE		struct s_primitive
# define TRANSFORM		struct s_transform
# define OBJ			union u_obj
# define VMLBOOL		enum e_vmlbool
# define FRUSTUM		VEC4
# define FLOAT_ZERO		1E-6
# define DOUBLE_ZERO	1E-6
# define PRIM_TYPE		enum e_prim_type
# define TO_RADIAN(x)	(x * 0.01745329251994329576923690768489f)
# define STEP(a, x)		(x >= a)
# define CLAMP(nbr, min, max)	(nbr <= min ? min : nbr >= max ? max : nbr)
# define CYCLE(nbr, min, max)	(nbr >= min ? max : nbr <= max ? min : nbr)

enum			e_vmlbool
{
	vmlfalse = 0,
	vmltrue = !vmlfalse
};

typedef struct	s_vec2
{
	float		x;
	float		y;
}				t_vec2;

typedef struct	s_vec3
{
	float		x;
	float		y;
	float		z;
}				t_vec3;

typedef struct	s_vec4
{
	float		x;
	float		y;
	float		z;
	float		w;
}				t_vec4;

typedef struct	s_mat2
{
	float		m[4];
}				t_mat2;

typedef struct	s_mat3
{
	float		m[9];
}				t_mat3;

typedef struct	s_mat4
{
	float		m[16];
}				t_mat4;

typedef struct	s_transform
{
	VMLBOOL		updated;
	VEC3		position;
	VEC3		rotation;
	VEC3		scaling;
	VEC3		up;
	MAT4		transform;
	MAT4		translate;
	MAT4		rotate;
	MAT4		scale;
}				t_transform;

enum e_prim_type
{
	sphere = 0x1,
	plane = 0x2,
	cylinder = 0x3,
	capped_cylinder = 0x4,
	cone = 0x5,
	capped_cone = 0x6,
	triangle = 0x7,
	disc = 0x8
};

typedef struct	s_sphere
{
	float		radius;
	float		radius2;
}				t_sphere;

typedef struct	s_plane
{
}				t_plane;

typedef struct	s_disc
{
	float		radius;
	float		radius2;
}				t_disc;

typedef struct	s_cylinder
{
	float		radius;
	float		radius2;
	float		size;
}				t_cylinder;

typedef struct	s_cone
{
	float		radius;
	float		radius2;
	float		size;
}				t_cone;

typedef struct	s_triangle
{
	VEC3		point[3];
}				t_triangle;

typedef union	u_obj
{
	t_sphere	sphere;
	t_plane		plane;
	t_cylinder	cylinder;
{'fraction_non_alphanumeric': 0.15373059589384075, 'fraction_numerical': 0.04223001168419296, 'mean_word_length': 1.8932882665379045, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1491124', 'n_tokens_mistral': 2653, 'n_tokens_neox': 2358, 'n_words': 531}