Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_aabb.c
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 */
19
28#include "nilorea/n_common.h"
29#include "nilorea/n_log.h"
30#include "nilorea/n_str.h"
31#include "nilorea/n_aabb.h"
32
44 AABB3D box;
45 box.xMin = xMin;
46 box.yMin = yMin;
47 box.zMin = zMin;
48 box.xMax = xMax;
49 box.yMax = yMax;
50 box.zMax = zMax;
51 return box;
52}
53
63 return (x >= box.xMin && x <= box.xMax &&
64 y >= box.yMin && y <= box.yMax &&
65 z >= box.zMin && z <= box.zMax);
66}
67
75 return (box1.xMin <= box2.xMax && box1.xMax >= box2.xMin &&
76 box1.yMin <= box2.yMax && box1.yMax >= box2.yMin &&
77 box1.zMin <= box2.zMax && box1.zMax >= box2.zMin);
78}
AABB_VALUE yMin
first edge y coordinate
Definition n_aabb.h:52
AABB_VALUE yMax
second edge y coordinate
Definition n_aabb.h:58
AABB_VALUE zMax
second edge z coordinate
Definition n_aabb.h:60
AABB_VALUE xMax
second edge x coordinate
Definition n_aabb.h:56
AABB_VALUE xMin
first edge x coordinate
Definition n_aabb.h:50
AABB_VALUE zMin
first edge z coordinate
Definition n_aabb.h:54
bool doAABB3DsIntersect(AABB3D box1, AABB3D box2)
check if two 3D AABBs intersect
Definition n_aabb.c:74
bool isPointInsideAABB3D(AABB3D box, AABB_VALUE x, AABB_VALUE y, AABB_VALUE z)
check if a point is inside a 3D AABB
Definition n_aabb.c:62
double AABB_VALUE
type of a AABB component
Definition n_aabb.h:45
AABB3D createAABB3D(AABB_VALUE xMin, AABB_VALUE yMin, AABB_VALUE zMin, AABB_VALUE xMax, AABB_VALUE yMax, AABB_VALUE zMax)
create a new AABB3D box
Definition n_aabb.c:43
Axis-Aligned Bounding Box (AABB) algorithm.
Definition n_aabb.h:48
AABB3D module headers.
Common headers and low-level functions & define.
Generic log system.
N_STR and string function declaration.