ObjFW  Check-in [e5f7c958ea]

Overview
Comment:Add OF3DVector
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 3d-affine-transforms
Files: files | file ages | folders
SHA3-256: e5f7c958ea93c598613289b9dbb93e12e0175428eaa46f38cb4a3dba71f3c7d4
User & Date: js on 2021-10-14 23:45:30
Other Links: branch diff | manifest | tags
Context
2022-11-07
00:23
Merge trunk into branch "3d-affine-transforms" check-in: 86f8767eca user: js tags: 3d-affine-transforms
2021-10-14
23:45
Add OF3DVector check-in: e5f7c958ea user: js tags: 3d-affine-transforms
2021-09-26
20:48
OF4x4Matrix: Add -[multiplyWithMatrix:] check-in: 42b5eee531 user: js tags: 3d-affine-transforms
Changes

Modified src/OFObject.h from [256748162e] to [4b442adb2a].

277
278
279
280
281
282
283




















































284
285
286
287
288
289
290
{
	if (!OFPointEqual(rect1.origin, rect2.origin))
		return false;

	if (!OFSizeEqual(rect1.size, rect2.size))
		return false;





















































	return true;
}

/**
 * @brief Adds the specified byte to the hash.
 *
 * @param hash A pointer to a hash to add the byte to







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
{
	if (!OFPointEqual(rect1.origin, rect2.origin))
		return false;

	if (!OFSizeEqual(rect1.size, rect2.size))
		return false;

	return true;
}

/**
 * @struct OF3DVector OFObject.h ObjFW/OFObject.h
 *
 * @brief A vector in 3D space.
 */
typedef struct OF_BOXABLE {
	/** The x coordinate of the vector */
	float x;
	/** The y coordinate of the vector */
	float y;
	/** The z coordinate of the vector */
	float z;
} OF3DVector;

/**
 * @brief Creates a new OF3DVector.
 *
 * @param x The x coordinate of the vector
 * @param y The x coordinate of the vector
 * @param z The z coordinate of the vector
 * @return An OF3DVector with the specified coordinates
 */
static OF_INLINE OF3DVector OF_CONST_FUNC
OF3DVectorMake(float x, float y, float z)
{
	OF3DVector vec = { x, y, z };

	return vec;
}

/**
 * @brief Returns whether the two vectors are equal.
 *
 * @param vec1 The first vector for the comparison
 * @param vec2 The second vector for the comparison
 * @return Whether the two vectors are equal
 */
static OF_INLINE bool
OF3DVectorEqual(OF3DVector vec1, OF3DVector vec2)
{
	if (vec1.x != vec2.x)
		return false;

	if (vec1.y != vec2.y)
		return false;

	if (vec1.z != vec2.z)
		return false;

	return true;
}

/**
 * @brief Adds the specified byte to the hash.
 *
 * @param hash A pointer to a hash to add the byte to