Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
graphene-point3d.h
Go to the documentation of this file.
1/* graphene-point3d.h: Point in 3D space
2 *
3 * SPDX-License-Identifier: MIT
4 *
5 * Copyright 2014 Emmanuele Bassi
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26#pragma once
27
28#if !defined(GRAPHENE_H_INSIDE) && !defined(GRAPHENE_COMPILATION)
29#error "Only graphene.h can be included directly."
30#endif
31
32#include "graphene-types.h"
33
35
36/**
37 * GRAPHENE_POINT3D_INIT:
38 * @_x: the X coordinate
39 * @_y: the Y coordinate
40 * @_z: the Z coordinate
41 *
42 * Initializes a #graphene_point3d_t to the given coordinates when declaring it.
43 *
44 * Since: 1.0
45 */
46#define GRAPHENE_POINT3D_INIT(_x,_y,_z) (graphene_point3d_t) { .x = (_x), .y = (_y), .z = (_z) }
47
48/**
49 * GRAPHENE_POINT3D_INIT_ZERO:
50 *
51 * Initializes a #graphene_point3d_t to (0, 0, 0) when declaring it.
52 *
53 * Since: 1.0
54 */
55#define GRAPHENE_POINT3D_INIT_ZERO GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f)
56
57/**
58 * graphene_point3d_t:
59 * @x: the X coordinate
60 * @y: the Y coordinate
61 * @z: the Z coordinate
62 *
63 * A point with three components: X, Y, and Z.
64 *
65 * Since: 1.0
66 */
68{
69 float x;
70 float y;
71 float z;
72};
73
78
81 float x,
82 float y,
83 float z);
86 const graphene_point3d_t *src);
89 const graphene_vec3_t *v);
93
96 const graphene_point3d_t *b);
99 const graphene_point3d_t *b,
100 float epsilon);
101
104 float factor,
105 graphene_point3d_t *res);
108 const graphene_point3d_t *b,
109 graphene_point3d_t *res);
112 const graphene_point3d_t *b);
117 graphene_point3d_t *res);
120 const graphene_point3d_t *b,
121 graphene_vec3_t *delta);
122
125 const graphene_point3d_t *b,
126 double factor,
127 graphene_point3d_t *res);
128
131 const graphene_rect_t *viewport,
132 float z_near,
133 float z_far,
134 graphene_point3d_t *res);
135
138
#define GRAPHENE_END_DECLS
#define GRAPHENE_BEGIN_DECLS
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point3d_to_vec3(const graphene_point3d_t *p, graphene_vec3_t *v)
GRAPHENE_AVAILABLE_IN_1_0 bool graphene_point3d_equal(const graphene_point3d_t *a, const graphene_point3d_t *b)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point3d_normalize(const graphene_point3d_t *p, graphene_point3d_t *res)
GRAPHENE_AVAILABLE_IN_1_0 float graphene_point3d_length(const graphene_point3d_t *p)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point3d_free(graphene_point3d_t *p)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point3d_interpolate(const graphene_point3d_t *a, const graphene_point3d_t *b, double factor, graphene_point3d_t *res)
GRAPHENE_AVAILABLE_IN_1_0 const graphene_point3d_t * graphene_point3d_zero(void)
GRAPHENE_AVAILABLE_IN_1_0 graphene_point3d_t * graphene_point3d_init(graphene_point3d_t *p, float x, float y, float z)
GRAPHENE_AVAILABLE_IN_1_0 bool graphene_point3d_near(const graphene_point3d_t *a, const graphene_point3d_t *b, float epsilon)
GRAPHENE_AVAILABLE_IN_1_4 void graphene_point3d_normalize_viewport(const graphene_point3d_t *p, const graphene_rect_t *viewport, float z_near, float z_far, graphene_point3d_t *res)
GRAPHENE_AVAILABLE_IN_1_0 float graphene_point3d_dot(const graphene_point3d_t *a, const graphene_point3d_t *b)
GRAPHENE_AVAILABLE_IN_1_0 graphene_point3d_t * graphene_point3d_init_from_point(graphene_point3d_t *p, const graphene_point3d_t *src)
GRAPHENE_AVAILABLE_IN_1_0 graphene_point3d_t * graphene_point3d_alloc(void)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point3d_scale(const graphene_point3d_t *p, float factor, graphene_point3d_t *res)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point3d_cross(const graphene_point3d_t *a, const graphene_point3d_t *b, graphene_point3d_t *res)
GRAPHENE_AVAILABLE_IN_1_0 graphene_point3d_t * graphene_point3d_init_from_vec3(graphene_point3d_t *p, const graphene_vec3_t *v)
GRAPHENE_AVAILABLE_IN_1_4 float graphene_point3d_distance(const graphene_point3d_t *a, const graphene_point3d_t *b, graphene_vec3_t *delta)
#define GRAPHENE_AVAILABLE_IN_1_4
#define GRAPHENE_AVAILABLE_IN_1_0