Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
graphene-point.h
Go to the documentation of this file.
1/* graphene-point.h: Point and Size
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_POINT_INIT:
38 * @_x: the X coordinate
39 * @_y: the Y coordinate
40 *
41 * Initializes a #graphene_point_t with the given coordinates
42 * when declaring it, e.g:
43 *
44 * |[<!-- language="C" -->
45 * graphene_point_t p = GRAPHENE_POINT_INIT (10.f, 10.f);
46 * ]|
47 *
48 * Since: 1.0
49 */
50#define GRAPHENE_POINT_INIT(_x,_y) (graphene_point_t) { .x = (_x), .y = (_y) }
51
52/**
53 * GRAPHENE_POINT_INIT_ZERO:
54 *
55 * Initializes a #graphene_point_t to (0, 0) when declaring it.
56 *
57 * Since: 1.0
58 */
59#define GRAPHENE_POINT_INIT_ZERO GRAPHENE_POINT_INIT (0.f, 0.f)
60
61/**
62 * graphene_point_t:
63 * @x: the X coordinate of the point
64 * @y: the Y coordinate of the point
65 *
66 * A point with two coordinates.
67 *
68 * Since: 1.0
69 */
71{
72 float x;
73 float y;
74};
75
80
83 float x,
84 float y);
87 const graphene_point_t *src);
90 const graphene_vec2_t *src);
93 const graphene_point_t *b);
94
97 const graphene_point_t *b,
98 float *d_x,
99 float *d_y);
100
103 const graphene_point_t *b,
104 float epsilon);
105
108 const graphene_point_t *b,
109 double factor,
110 graphene_point_t *res);
111
114 graphene_vec2_t *v);
115
118
#define GRAPHENE_END_DECLS
#define GRAPHENE_BEGIN_DECLS
GRAPHENE_AVAILABLE_IN_1_0 graphene_point_t * graphene_point_init(graphene_point_t *p, float x, float y)
GRAPHENE_AVAILABLE_IN_1_4 void graphene_point_to_vec2(const graphene_point_t *p, graphene_vec2_t *v)
GRAPHENE_AVAILABLE_IN_1_0 float graphene_point_distance(const graphene_point_t *a, const graphene_point_t *b, float *d_x, float *d_y)
GRAPHENE_AVAILABLE_IN_1_0 const graphene_point_t * graphene_point_zero(void)
GRAPHENE_AVAILABLE_IN_1_0 bool graphene_point_near(const graphene_point_t *a, const graphene_point_t *b, float epsilon)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point_interpolate(const graphene_point_t *a, const graphene_point_t *b, double factor, graphene_point_t *res)
GRAPHENE_AVAILABLE_IN_1_4 graphene_point_t * graphene_point_init_from_vec2(graphene_point_t *p, const graphene_vec2_t *src)
GRAPHENE_AVAILABLE_IN_1_0 graphene_point_t * graphene_point_init_from_point(graphene_point_t *p, const graphene_point_t *src)
GRAPHENE_AVAILABLE_IN_1_0 void graphene_point_free(graphene_point_t *p)
GRAPHENE_AVAILABLE_IN_1_0 graphene_point_t * graphene_point_alloc(void)
GRAPHENE_AVAILABLE_IN_1_0 bool graphene_point_equal(const graphene_point_t *a, const graphene_point_t *b)
#define GRAPHENE_AVAILABLE_IN_1_4
#define GRAPHENE_AVAILABLE_IN_1_0