GDS-Render v1.2.1
vector-operations.h
Go to the documentation of this file.
1/*
2 * GDSII-Converter
3 * Copyright (C) 2018 Mario Hüttel <mario.huettel@gmx.net>
4 *
5 * This file is part of GDSII-Converter.
6 *
7 * GDSII-Converter is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * GDSII-Converter is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GDSII-Converter. If not, see <http://www.gnu.org/licenses/>.
18 */
19
32#ifndef _VECTOR_OPERATIONS_H_
33#define _VECTOR_OPERATIONS_H_
34
35#include <math.h>
36
37struct vector_2d {
38 double x;
39 double y;
40};
41
42#define DEG2RAD(a) ((a)*M_PI/180.0)
43
44double vector_2d_scalar_multipy(struct vector_2d *a, struct vector_2d *b);
45void vector_2d_normalize(struct vector_2d *vec);
46void vector_2d_rotate(struct vector_2d *vec, double angle);
47struct vector_2d *vector_2d_copy(struct vector_2d *opt_res, struct vector_2d *vec);
48struct vector_2d *vector_2d_alloc(void);
49void vector_2d_free(struct vector_2d *vec);
50void vector_2d_scale(struct vector_2d *vec, double scale);
51double vector_2d_abs(struct vector_2d *vec);
52double vector_2d_calculate_angle_between(struct vector_2d *a, struct vector_2d *b);
53void vector_2d_subtract(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b);
54void vector_2d_add(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b);
55
56#endif /* _VECTOR_OPERATIONS_H_ */
57
void vector_2d_scale(struct vector_2d *vec, double scale)
struct vector_2d * vector_2d_alloc(void)
void vector_2d_rotate(struct vector_2d *vec, double angle)
struct vector_2d * vector_2d_copy(struct vector_2d *opt_res, struct vector_2d *vec)
void vector_2d_normalize(struct vector_2d *vec)
double vector_2d_scalar_multipy(struct vector_2d *a, struct vector_2d *b)
double vector_2d_calculate_angle_between(struct vector_2d *a, struct vector_2d *b)
void vector_2d_subtract(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b)
double vector_2d_abs(struct vector_2d *vec)
void vector_2d_add(struct vector_2d *res, struct vector_2d *a, struct vector_2d *b)
void vector_2d_free(struct vector_2d *vec)