zemu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/zemu/config.rb +312 -0
- data/lib/zemu/instance.rb +179 -0
- data/lib/zemu.rb +172 -0
- data/src/debug.c +118 -0
- data/src/debug.h +30 -0
- data/src/external/Z/API/Z/ABIs/generic/allocator.h +36 -0
- data/src/external/Z/API/Z/ABIs/generic/cipher.h +47 -0
- data/src/external/Z/API/Z/ABIs/generic/data codec.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/emulation.h +103 -0
- data/src/external/Z/API/Z/ABIs/generic/hash function.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/module.h +33 -0
- data/src/external/Z/API/Z/ABIs/generic/wave codec.h +40 -0
- data/src/external/Z/API/Z/classes/base/InitializerList.hpp +34 -0
- data/src/external/Z/API/Z/classes/base/OpaqueFunctionPointer.hpp +26 -0
- data/src/external/Z/API/Z/classes/base/OpaqueMemberFunctionPointer.hpp +26 -0
- data/src/external/Z/API/Z/classes/base/Pair.hpp +46 -0
- data/src/external/Z/API/Z/classes/base/Range.hpp +111 -0
- data/src/external/Z/API/Z/classes/base/SizedString.hpp +66 -0
- data/src/external/Z/API/Z/classes/base/Status.hpp +89 -0
- data/src/external/Z/API/Z/classes/base/Symbol.hpp +39 -0
- data/src/external/Z/API/Z/classes/base/Tuple.hpp +111 -0
- data/src/external/Z/API/Z/classes/base/Value2D.hpp +389 -0
- data/src/external/Z/API/Z/classes/base/Value3D.hpp +368 -0
- data/src/external/Z/API/Z/classes/buffering/RingBuffer.hpp +93 -0
- data/src/external/Z/API/Z/classes/buffering/TripleBuffer.hpp +68 -0
- data/src/external/Z/API/Z/classes/functional/Functor.hpp +265 -0
- data/src/external/Z/API/Z/classes/functional/MemberFunction.hpp +98 -0
- data/src/external/Z/API/Z/classes/functional/ObjectMemberFunction.hpp +172 -0
- data/src/external/Z/API/Z/classes/functional/ObjectSelector.hpp +219 -0
- data/src/external/Z/API/Z/classes/functional/Selector.hpp +146 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABB.hpp +81 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABR.hpp +685 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Box.hpp +219 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Circle.hpp +80 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line2D.hpp +93 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line3D.hpp +80 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Rectangle.hpp +675 -0
- data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Sphere.hpp +0 -0
- data/src/external/Z/API/Z/classes/memory/Shared.hpp +90 -0
- data/src/external/Z/API/Z/constants/base.h +35 -0
- data/src/external/Z/API/Z/constants/chemical elements.h +6385 -0
- data/src/external/Z/API/Z/constants/numbers.h +963 -0
- data/src/external/Z/API/Z/constants/version.h +15 -0
- data/src/external/Z/API/Z/formats/character set/ASCII.h +158 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP437.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP737.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP775.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP850.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP852.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP855.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP857.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP858.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP860.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP861.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP862.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP863.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP864.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP865.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP866.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP869.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP872.h +159 -0
- data/src/external/Z/API/Z/formats/character set/DOS CP874.h +159 -0
- data/src/external/Z/API/Z/formats/character set/Unicode.h +30119 -0
- data/src/external/Z/API/Z/formats/data model/I16LP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/ILP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/ILP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/IP16L32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LLP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LP32.h +19 -0
- data/src/external/Z/API/Z/formats/data model/LP64.h +19 -0
- data/src/external/Z/API/Z/formats/data model/SILP64.h +19 -0
- data/src/external/Z/API/Z/formats/file system/FAT12.h +61 -0
- data/src/external/Z/API/Z/formats/floating-point/IEEE 754.h +141 -0
- data/src/external/Z/API/Z/formats/floating-point/x87.h +74 -0
- data/src/external/Z/API/Z/formats/image/ICNS.h +39 -0
- data/src/external/Z/API/Z/formats/keymap/Mac OS.h +284 -0
- data/src/external/Z/API/Z/formats/keymap/Z.h +141 -0
- data/src/external/Z/API/Z/formats/multimedia/Creative Voice.h +106 -0
- data/src/external/Z/API/Z/formats/multimedia/Microsoft Wave.h +49 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ACH.h +44 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/FRZ.h +54 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/PRG.h +33 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SEM.h +46 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SIT.h +34 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNA.h +117 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNP.h +37 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SP.h +62 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/Z80.h +117 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX.h +56 -0
- data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX82.h +70 -0
- data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/UNIF.h +26 -0
- data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/iNES.h +76 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/TAP.h +25 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/TZX.h +1185 -0
- data/src/external/Z/API/Z/formats/storage medium image/audio/Warajevo TAP.h +32 -0
- data/src/external/Z/API/Z/formats/storage medium image/floppy disk/FDI.h +45 -0
- data/src/external/Z/API/Z/functions/base/Z2D.h +583 -0
- data/src/external/Z/API/Z/functions/base/Z3D.h +712 -0
- data/src/external/Z/API/Z/functions/base/ZRange.h +137 -0
- data/src/external/Z/API/Z/functions/base/all.h +16 -0
- data/src/external/Z/API/Z/functions/base/casting.hpp +37 -0
- data/src/external/Z/API/Z/functions/base/character.h +38 -0
- data/src/external/Z/API/Z/functions/base/constructors.h +326 -0
- data/src/external/Z/API/Z/functions/base/structure.hpp +26 -0
- data/src/external/Z/API/Z/functions/base/type.hpp +60 -0
- data/src/external/Z/API/Z/functions/base/value.h +1901 -0
- data/src/external/Z/API/Z/functions/base/value.hpp +112 -0
- data/src/external/Z/API/Z/functions/buffering/ZRingBuffer.h +85 -0
- data/src/external/Z/API/Z/functions/buffering/ZTripleBuffer.h +65 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z2DLine.h +179 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z3DLine.h +168 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABB.h +361 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABR.h +1081 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZBox.h +340 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZCircle.h +142 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZRectangle.h +1267 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZSphere.h +156 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/all.h +18 -0
- data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/constructors.h +620 -0
- data/src/external/Z/API/Z/functions/time/date.h +29 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/6502.h +90 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/Z80.h +245 -0
- data/src/external/Z/API/Z/hardware/CPU/architecture/i4004.h +37 -0
- data/src/external/Z/API/Z/hardware/PSG/General Instrument/AY-3-891x.h +180 -0
- data/src/external/Z/API/Z/hardware/VDC/Ricoh/RP2C0x.h +625 -0
- data/src/external/Z/API/Z/hardware/bus/AGP.h +24 -0
- data/src/external/Z/API/Z/hardware/bus/USB.h +510 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Inves Spectrum +.h +47 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Pentagon.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Scorpion.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum + 128K.h +158 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +.h +82 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2A.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +3.h +13 -0
- data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum.h +109 -0
- data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (NTSC).h +29 -0
- data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (PAL).h +29 -0
- data/src/external/Z/API/Z/hardware/machine/platform/computer/ZX Spectrum.h +405 -0
- data/src/external/Z/API/Z/hardware/machine/platform/console/Game Boy.h +49 -0
- data/src/external/Z/API/Z/hardware/machine/platform/console/Nintendo Entertainment System.h +350 -0
- data/src/external/Z/API/Z/hardware/storage medium/ROM cartridge/SNES Game Pak.h +238 -0
- data/src/external/Z/API/Z/inspection/C/completion.h +178 -0
- data/src/external/Z/API/Z/inspection/C/modules/C11.h +41 -0
- data/src/external/Z/API/Z/inspection/C/modules/C18.h +13 -0
- data/src/external/Z/API/Z/inspection/C/modules/C89.h +19 -0
- data/src/external/Z/API/Z/inspection/C/modules/C90.h +13 -0
- data/src/external/Z/API/Z/inspection/C/modules/C94.h +15 -0
- data/src/external/Z/API/Z/inspection/C/modules/C99.h +29 -0
- data/src/external/Z/API/Z/inspection/C/modules/KR C.h +19 -0
- data/src/external/Z/API/Z/inspection/C++/completion.h +512 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++03.h +15 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++11.h +80 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++14.h +26 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++17.h +55 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++85.h +11 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++89.h +13 -0
- data/src/external/Z/API/Z/inspection/C++/modules/C++98.h +17 -0
- data/src/external/Z/API/Z/inspection/C++.h +78 -0
- data/src/external/Z/API/Z/inspection/C.h +79 -0
- data/src/external/Z/API/Z/inspection/CPU/completion.h +56 -0
- data/src/external/Z/API/Z/inspection/CPU/detection.h +714 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/6502.h +25 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/AArch32.h +32 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/AArch64.h +32 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/Z80.h +26 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/x86-32.h +31 -0
- data/src/external/Z/API/Z/inspection/CPU/modules/x86-64.h +312 -0
- data/src/external/Z/API/Z/inspection/CPU.h +209 -0
- data/src/external/Z/API/Z/inspection/OS/completion.h +36 -0
- data/src/external/Z/API/Z/inspection/OS/detection.h +768 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Linux.h +22 -0
- data/src/external/Z/API/Z/inspection/OS/modules/MS-DOS.h +16 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Mac OS X.h +23 -0
- data/src/external/Z/API/Z/inspection/OS/modules/Windows.h +19 -0
- data/src/external/Z/API/Z/inspection/OS/modules/iPhone OS.h +23 -0
- data/src/external/Z/API/Z/inspection/OS.h +236 -0
- data/src/external/Z/API/Z/inspection/Objective-C/completion.h +8 -0
- data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v1.0.h +11 -0
- data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v2.0.h +15 -0
- data/src/external/Z/API/Z/inspection/Objective-C.h +51 -0
- data/src/external/Z/API/Z/inspection/Z.h +19 -0
- data/src/external/Z/API/Z/inspection/build.h +22 -0
- data/src/external/Z/API/Z/inspection/character set.h +66 -0
- data/src/external/Z/API/Z/inspection/compiler/completion.h +2885 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Apple LLVM.h +26 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Clang.h +1664 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/GCC.h +1366 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/SCCZ80.h +473 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/Visual C++.h +606 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/cc65.h +529 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/generic.h +13 -0
- data/src/external/Z/API/Z/inspection/compiler/modules/template.h +650 -0
- data/src/external/Z/API/Z/inspection/compiler.h +299 -0
- data/src/external/Z/API/Z/inspection/data model/completion.h +128 -0
- data/src/external/Z/API/Z/inspection/data model/deduction.h +9 -0
- data/src/external/Z/API/Z/inspection/data model/detection.h +45 -0
- data/src/external/Z/API/Z/inspection/data model.h +362 -0
- data/src/external/Z/API/Z/inspection/floating-point/completion.h +50 -0
- data/src/external/Z/API/Z/inspection/floating-point.h +324 -0
- data/src/external/Z/API/Z/inspection/language.h +163 -0
- data/src/external/Z/API/Z/inspection/platform/detection.h +9 -0
- data/src/external/Z/API/Z/inspection/platform.h +29 -0
- data/src/external/Z/API/Z/keys/C++.h +27 -0
- data/src/external/Z/API/Z/keys/C.h +29 -0
- data/src/external/Z/API/Z/keys/CPU.h +80 -0
- data/src/external/Z/API/Z/keys/OS.h +182 -0
- data/src/external/Z/API/Z/keys/Objective-C.h +17 -0
- data/src/external/Z/API/Z/keys/chemistry.h +26 -0
- data/src/external/Z/API/Z/keys/compiler.h +178 -0
- data/src/external/Z/API/Z/keys/data model.h +32 -0
- data/src/external/Z/API/Z/keys/endianness.h +24 -0
- data/src/external/Z/API/Z/keys/language.h +21 -0
- data/src/external/Z/API/Z/keys/layout.h +20 -0
- data/src/external/Z/API/Z/keys/mathematics/geometry.h +29 -0
- data/src/external/Z/API/Z/keys/mathematics/number.h +21 -0
- data/src/external/Z/API/Z/keys/order.h +18 -0
- data/src/external/Z/API/Z/keys/platform.h +87 -0
- data/src/external/Z/API/Z/keys/program.h +39 -0
- data/src/external/Z/API/Z/keys/science/chemical elements.h +200 -0
- data/src/external/Z/API/Z/keys/science/electricity.h +18 -0
- data/src/external/Z/API/Z/keys/science/magnetism.h +19 -0
- data/src/external/Z/API/Z/keys/status.h +69 -0
- data/src/external/Z/API/Z/keys/text.h +27 -0
- data/src/external/Z/API/Z/keys/value.h +88 -0
- data/src/external/Z/API/Z/macros/arguments.h +25 -0
- data/src/external/Z/API/Z/macros/casting.h +22 -0
- data/src/external/Z/API/Z/macros/character.h +159 -0
- data/src/external/Z/API/Z/macros/date.h +14 -0
- data/src/external/Z/API/Z/macros/key.h +20 -0
- data/src/external/Z/API/Z/macros/language.h +126 -0
- data/src/external/Z/API/Z/macros/language.hpp +81 -0
- data/src/external/Z/API/Z/macros/members.h +86 -0
- data/src/external/Z/API/Z/macros/pasting.h +308 -0
- data/src/external/Z/API/Z/macros/pointer.h +33 -0
- data/src/external/Z/API/Z/macros/repetition.h +283 -0
- data/src/external/Z/API/Z/macros/structure.h +104 -0
- data/src/external/Z/API/Z/macros/templating.h +407 -0
- data/src/external/Z/API/Z/macros/tokens.h +14 -0
- data/src/external/Z/API/Z/macros/type enumeration.h +43 -0
- data/src/external/Z/API/Z/macros/type selection.hpp +76 -0
- data/src/external/Z/API/Z/macros/value.h +489 -0
- data/src/external/Z/API/Z/macros/variadic pasting.h +21 -0
- data/src/external/Z/API/Z/macros/variadic selection.h +56 -0
- data/src/external/Z/API/Z/macros/variadic.h +46 -0
- data/src/external/Z/API/Z/macros/version.h +17 -0
- data/src/external/Z/API/Z/network/3/IP.h +36 -0
- data/src/external/Z/API/Z/network/4/TCP.h +24 -0
- data/src/external/Z/API/Z/network/4/UDP.h +26 -0
- data/src/external/Z/API/Z/network/7/ED2K.h +104 -0
- data/src/external/Z/API/Z/network/7/HTTP.h +100 -0
- data/src/external/Z/API/Z/traits/SelectType.hpp +71 -0
- data/src/external/Z/API/Z/traits/TernaryType.hpp +20 -0
- data/src/external/Z/API/Z/traits/Type.hpp +4516 -0
- data/src/external/Z/API/Z/traits/TypeCount.hpp +52 -0
- data/src/external/Z/API/Z/traits/TypeList.hpp +376 -0
- data/src/external/Z/API/Z/traits/base.hpp +19 -0
- data/src/external/Z/API/Z/traits/filtering.hpp +30 -0
- data/src/external/Z/API/Z/traits/mathematics.hpp +48 -0
- data/src/external/Z/API/Z/types/arguments.h +19 -0
- data/src/external/Z/API/Z/types/base.h +1655 -0
- data/src/external/Z/API/Z/types/base.hpp +169 -0
- data/src/external/Z/API/Z/types/buffering.h +27 -0
- data/src/external/Z/API/Z/types/mathematics.h +135 -0
- data/src/external/Z/API/Z/types/time.h +23 -0
- data/src/external/Z/COPYING.LESSER +165 -0
- data/src/external/Z/development/Qt Creator/Z.pro +253 -0
- data/src/external/Z/distribution/CocoaPods/Zeta.podspec +18 -0
- data/src/external/Z/distribution/Gentoo Linux/Zeta-0.1.ebuild +22 -0
- data/src/external/Z/distribution/Gentoo Linux/metadata.xml +8 -0
- data/src/external/Z/distribution/Homebrew/Zeta.rb +11 -0
- data/src/external/z80/API/emulation/CPU/Z80.h +201 -0
- data/src/external/z80/README.md +229 -0
- data/src/external/z80/building/premake4.lua +33 -0
- data/src/external/z80/development/Xcode/Z80.xcodeproj/project.pbxproj +520 -0
- data/src/external/z80/sources/Z80.c +1660 -0
- data/src/interrupt.c +6 -0
- data/src/interrupt.h +3 -0
- data/src/io.c.erb +115 -0
- data/src/io.h.erb +18 -0
- data/src/main.c +69 -0
- data/src/memory.c.erb +43 -0
- data/src/memory.h.erb +9 -0
- metadata +329 -0
@@ -0,0 +1,1081 @@
|
|
1
|
+
/* Z Kit - functions/mathematics/geometry/euclidean/ZAABR.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
|
6
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
7
|
+
|
8
|
+
#ifndef _Z_functions_mathematics_geometry_euclidean_ZAABR_H_
|
9
|
+
#define _Z_functions_mathematics_geometry_euclidean_ZAABR_H_
|
10
|
+
|
11
|
+
#include <Z/functions/mathematics/geometry/euclidean/Z2DLine.h>
|
12
|
+
|
13
|
+
|
14
|
+
/* MARK: - Common implementation */
|
15
|
+
|
16
|
+
|
17
|
+
#define Z_IMPLEMENTATION_COMMON(Type, type) \
|
18
|
+
\
|
19
|
+
static Z_INLINE \
|
20
|
+
ZAABR##Type z_aabr_##type##_align_in_bottom_center(ZAABR##Type object, Z2D##Type size) \
|
21
|
+
{ \
|
22
|
+
object.b.x = (object.a.x += (object.b.x - object.a.x - size.x) / (z##type)2) + size.x; \
|
23
|
+
object.b.y = object.a.y + size.y; \
|
24
|
+
return object; \
|
25
|
+
} \
|
26
|
+
\
|
27
|
+
\
|
28
|
+
static Z_INLINE \
|
29
|
+
ZAABR##Type z_aabr_##type##_align_in_bottom_left(ZAABR##Type object, Z2D##Type size) \
|
30
|
+
{ \
|
31
|
+
object.b.x = object.a.x + size.x; \
|
32
|
+
object.b.y = object.a.y + size.y; \
|
33
|
+
return object; \
|
34
|
+
} \
|
35
|
+
\
|
36
|
+
\
|
37
|
+
static Z_INLINE \
|
38
|
+
ZAABR##Type z_aabr_##type##_align_in_bottom_right(ZAABR##Type object, Z2D##Type size) \
|
39
|
+
{ \
|
40
|
+
object.a.x = object.b.x - size.x; \
|
41
|
+
object.b.y = object.b.y + size.x; \
|
42
|
+
return object; \
|
43
|
+
} \
|
44
|
+
\
|
45
|
+
\
|
46
|
+
static Z_INLINE \
|
47
|
+
ZAABR##Type z_aabr_##type##_align_in_center(ZAABR##Type object, Z2D##Type size) \
|
48
|
+
{ \
|
49
|
+
object.b.x = (object.a.x += (object.b.x - object.a.x - size.x) / (z##type)2) + size.x; \
|
50
|
+
object.b.y = (object.a.y += (object.b.y - object.a.y - size.y) / (z##type)2) + size.y; \
|
51
|
+
return object; \
|
52
|
+
} \
|
53
|
+
\
|
54
|
+
\
|
55
|
+
static Z_INLINE \
|
56
|
+
ZAABR##Type z_aabr_##type##_align_in_center_left(ZAABR##Type object, Z2D##Type size) \
|
57
|
+
{ \
|
58
|
+
object.b.x = object.a.x + size.x; \
|
59
|
+
object.b.y = (object.a.y += (object.b.y - object.a.y - size.y) / (z##type)2) + size.y; \
|
60
|
+
return object; \
|
61
|
+
} \
|
62
|
+
\
|
63
|
+
\
|
64
|
+
static Z_INLINE \
|
65
|
+
ZAABR##Type z_aabr_##type##_align_in_center_right(ZAABR##Type object, Z2D##Type size) \
|
66
|
+
{ \
|
67
|
+
object.a.x = object.b.x - size.x; \
|
68
|
+
object.b.y = (object.a.y += (object.b.y - object.a.y - size.y) / (z##type)2) + size.y; \
|
69
|
+
return object; \
|
70
|
+
} \
|
71
|
+
\
|
72
|
+
\
|
73
|
+
static Z_INLINE \
|
74
|
+
ZAABR##Type z_aabr_##type##_align_in_top_center(ZAABR##Type object, Z2D##Type size) \
|
75
|
+
{ \
|
76
|
+
object.a.y = object.b.y - size.y; \
|
77
|
+
object.b.x = (object.a.x += (object.b.x - object.a.x - size.x) / (z##type)2) + size.x; \
|
78
|
+
return object; \
|
79
|
+
} \
|
80
|
+
\
|
81
|
+
\
|
82
|
+
static Z_INLINE \
|
83
|
+
ZAABR##Type z_aabr_##type##_align_in_top_left(ZAABR##Type object, Z2D##Type size) \
|
84
|
+
{ \
|
85
|
+
object.a.y = object.b.y - size.y; \
|
86
|
+
object.b.x = object.a.x + size.x; \
|
87
|
+
return object; \
|
88
|
+
} \
|
89
|
+
\
|
90
|
+
\
|
91
|
+
static Z_INLINE \
|
92
|
+
ZAABR##Type z_aabr_##type##_align_in_top_right(ZAABR##Type object, Z2D##Type size) \
|
93
|
+
{ \
|
94
|
+
object.a.x = object.b.x - size.x; \
|
95
|
+
object.a.y = object.b.y - size.y; \
|
96
|
+
return object; \
|
97
|
+
} \
|
98
|
+
\
|
99
|
+
\
|
100
|
+
static Z_INLINE \
|
101
|
+
z##type z_aabr_##type##_area(ZAABR##Type object) \
|
102
|
+
{return z_2d_##type##_inner_product(z_2d_##type##_subtract(object.b, object.a));} \
|
103
|
+
\
|
104
|
+
\
|
105
|
+
static Z_INLINE \
|
106
|
+
Z2D##Type z_aabr_##type##_bottom_center(ZAABR##Type object) \
|
107
|
+
{return z_2d_##type((object.a.x + object.b.x) / (z##type)2, object.a.y);} \
|
108
|
+
\
|
109
|
+
\
|
110
|
+
static Z_INLINE \
|
111
|
+
ZAABR##Type z_aabr_##type##_bottom_half(ZAABR##Type object) \
|
112
|
+
{ \
|
113
|
+
object.b.y = (object.a.y + object.b.y) / (z##type)2; \
|
114
|
+
return object; \
|
115
|
+
} \
|
116
|
+
\
|
117
|
+
\
|
118
|
+
static Z_INLINE \
|
119
|
+
Z2D##Type z_aabr_##type##_bottom_left(ZAABR##Type object) \
|
120
|
+
{return object.a;} \
|
121
|
+
\
|
122
|
+
\
|
123
|
+
static Z_INLINE \
|
124
|
+
ZAABR##Type z_aabr_##type##_bottom_left_quarter(ZAABR##Type object) \
|
125
|
+
{ \
|
126
|
+
object.b.x = (object.a.x + object.b.x) / (z##type)2; \
|
127
|
+
object.b.y = (object.a.y + object.b.y) / (z##type)2; \
|
128
|
+
return object; \
|
129
|
+
} \
|
130
|
+
\
|
131
|
+
\
|
132
|
+
static Z_INLINE \
|
133
|
+
Z2D##Type z_aabr_##type##_bottom_right(ZAABR##Type object) \
|
134
|
+
{return z_2d_##type(object.b.x, object.a.y);} \
|
135
|
+
\
|
136
|
+
\
|
137
|
+
static Z_INLINE \
|
138
|
+
ZAABR##Type z_aabr_##type##_bottom_right_quarter(ZAABR##Type object) \
|
139
|
+
{ \
|
140
|
+
object.a.x = (object.a.x + object.b.x) / (z##type)2; \
|
141
|
+
object.b.y = (object.a.y + object.b.y) / (z##type)2; \
|
142
|
+
return object; \
|
143
|
+
} \
|
144
|
+
\
|
145
|
+
\
|
146
|
+
static Z_INLINE \
|
147
|
+
Z2D##Type z_aabr_##type##_center_left(ZAABR##Type object) \
|
148
|
+
{return z_2d_##type(object.a.x, (object.a.y + object.b.y) / (z##type)2);} \
|
149
|
+
\
|
150
|
+
\
|
151
|
+
static Z_INLINE \
|
152
|
+
Z2D##Type z_aabr_##type##_center_right(ZAABR##Type object) \
|
153
|
+
{return z_2d_##type(object.b.x, (object.a.y + object.b.y) / (z##type)2);} \
|
154
|
+
\
|
155
|
+
\
|
156
|
+
static Z_INLINE \
|
157
|
+
zboolean z_aabr_##type##_contains(ZAABR##Type object, ZAABR##Type other) \
|
158
|
+
{ \
|
159
|
+
return other.a.x != other.b.x && other.a.y != other.b.y && \
|
160
|
+
other.a.x >= object.a.x && other.a.y >= object.a.y && \
|
161
|
+
other.b.x <= object.b.x && other.b.y <= object.b.y; \
|
162
|
+
} \
|
163
|
+
\
|
164
|
+
\
|
165
|
+
static Z_INLINE \
|
166
|
+
zboolean z_aabr_##type##_contains_point(ZAABR##Type object, Z2D##Type point) \
|
167
|
+
{ \
|
168
|
+
return point.x >= object.a.x && point.y >= object.a.y && \
|
169
|
+
point.x < object.b.x && point.y < object.b.y; \
|
170
|
+
} \
|
171
|
+
\
|
172
|
+
\
|
173
|
+
static Z_INLINE \
|
174
|
+
zboolean z_aabr_##type##_contains_rectangle(ZAABR##Type object, ZRectangle##Type rectangle) \
|
175
|
+
{ \
|
176
|
+
return rectangle.size.x != (z##type)0 && \
|
177
|
+
rectangle.size.y != (z##type)0 && \
|
178
|
+
rectangle.point.x >= object.a.x && \
|
179
|
+
rectangle.point.y >= object.a.y && \
|
180
|
+
rectangle.point.x + rectangle.size.x <= object.b.x && \
|
181
|
+
rectangle.point.y + rectangle.size.y <= object.b.y; \
|
182
|
+
} \
|
183
|
+
\
|
184
|
+
\
|
185
|
+
static Z_INLINE \
|
186
|
+
Z2D##Type z_aabr_##type##_size(ZAABR##Type object) \
|
187
|
+
{return z_2d_##type##_subtract(object.b, object.a);} \
|
188
|
+
\
|
189
|
+
\
|
190
|
+
static Z_INLINE \
|
191
|
+
ZAABR##Type z_aabr_##type##_fit_in_bottom_center(ZAABR##Type object, Z2D##Type size) \
|
192
|
+
{ \
|
193
|
+
Z2D##Type old_size = z_aabr_##type##_size(object); \
|
194
|
+
\
|
195
|
+
object.b.y = object.a.y + (size = z_2d_##type##_fit(size, old_size)).y; \
|
196
|
+
object.b.x = (object.a.x += (old_size.x - size.x) / (z##type)2) + size.x; \
|
197
|
+
return object; \
|
198
|
+
} \
|
199
|
+
\
|
200
|
+
\
|
201
|
+
static Z_INLINE \
|
202
|
+
ZAABR##Type z_aabr_##type##_fit_in_bottom_left(ZAABR##Type object, Z2D##Type size) \
|
203
|
+
{ \
|
204
|
+
object.b = z_2d_##type##_add \
|
205
|
+
(object.a, z_2d_##type##_fit(size, z_aabr_##type##_size(object))); \
|
206
|
+
\
|
207
|
+
return object; \
|
208
|
+
} \
|
209
|
+
\
|
210
|
+
\
|
211
|
+
static Z_INLINE \
|
212
|
+
ZAABR##Type z_aabr_##type##_fit_in_bottom_right(ZAABR##Type object, Z2D##Type size) \
|
213
|
+
{ \
|
214
|
+
size = z_2d_##type##_fit(size, z_aabr_##type##_size(object)); \
|
215
|
+
return z_aabr_##type(object.b.x - size.x, object.a.y, object.b.x, object.a.y + size.y); \
|
216
|
+
} \
|
217
|
+
\
|
218
|
+
\
|
219
|
+
static Z_INLINE \
|
220
|
+
ZAABR##Type z_aabr_##type##_fit_in_center(ZAABR##Type object, Z2D##Type size) \
|
221
|
+
{ \
|
222
|
+
Z2D##Type old_size = z_aabr_##type##_size(object); \
|
223
|
+
\
|
224
|
+
size = z_2d_##type##_fit(size, old_size); \
|
225
|
+
object.b.x = (object.a.x += (old_size.x - size.x) / (z##type)2) + size.x; \
|
226
|
+
object.b.y = (object.a.y += (old_size.y - size.y) / (z##type)2) + size.y; \
|
227
|
+
return object; \
|
228
|
+
} \
|
229
|
+
\
|
230
|
+
\
|
231
|
+
static Z_INLINE \
|
232
|
+
ZAABR##Type z_aabr_##type##_fit_in_center_left(ZAABR##Type object, Z2D##Type size) \
|
233
|
+
{ \
|
234
|
+
Z2D##Type old_size = z_aabr_##type##_size(object); \
|
235
|
+
\
|
236
|
+
object.b.x = object.a.x + (size = z_2d_##type##_fit(size, old_size)).x; \
|
237
|
+
object.b.y = (object.a.y += (old_size.y - size.y) / (z##type)2) + size.y; \
|
238
|
+
return object; \
|
239
|
+
} \
|
240
|
+
\
|
241
|
+
\
|
242
|
+
static Z_INLINE \
|
243
|
+
ZAABR##Type z_aabr_##type##_fit_in_center_right(ZAABR##Type object, Z2D##Type size) \
|
244
|
+
{ \
|
245
|
+
Z2D##Type old_size = z_aabr_##type##_size(object); \
|
246
|
+
\
|
247
|
+
object.a.x = object.b.x - (size = z_2d_##type##_fit(size, old_size)).x; \
|
248
|
+
object.b.y = (object.a.y += (old_size.y - size.y) / (z##type)2) + size.y; \
|
249
|
+
return object; \
|
250
|
+
} \
|
251
|
+
\
|
252
|
+
\
|
253
|
+
static Z_INLINE \
|
254
|
+
ZAABR##Type z_aabr_##type##_fit_in_top_center(ZAABR##Type object, Z2D##Type size) \
|
255
|
+
{ \
|
256
|
+
Z2D##Type old_size = z_aabr_##type##_size(object); \
|
257
|
+
\
|
258
|
+
object.a.y = object.b.y - (size = z_2d_##type##_fit(size, old_size)).y; \
|
259
|
+
object.b.x = (object.a.x += (old_size.x - size.x) / (z##type)2) + size.x; \
|
260
|
+
return object; \
|
261
|
+
} \
|
262
|
+
\
|
263
|
+
\
|
264
|
+
static Z_INLINE \
|
265
|
+
ZAABR##Type z_aabr_##type##_fit_in_top_left(ZAABR##Type object, Z2D##Type size) \
|
266
|
+
{ \
|
267
|
+
size = z_2d_##type##_fit(size, z_aabr_##type##_size(object)); \
|
268
|
+
\
|
269
|
+
object.a.y = object.b.y - size.y; \
|
270
|
+
object.b.x = object.a.x + size.x; \
|
271
|
+
return object; \
|
272
|
+
} \
|
273
|
+
\
|
274
|
+
\
|
275
|
+
static Z_INLINE \
|
276
|
+
ZAABR##Type z_aabr_##type##_fit_in_top_right(ZAABR##Type object, Z2D##Type size) \
|
277
|
+
{ \
|
278
|
+
object.a = z_2d_##type##_subtract \
|
279
|
+
(object.b, z_2d_##type##_fit(size, z_aabr_##type##_size(object))); \
|
280
|
+
\
|
281
|
+
return object; \
|
282
|
+
} \
|
283
|
+
\
|
284
|
+
\
|
285
|
+
static Z_INLINE \
|
286
|
+
ZAABR##Type z_aabr_##type##_from_vertices(Z2D##Type a, Z2D##Type b) \
|
287
|
+
{ \
|
288
|
+
ZAABR##Type result; \
|
289
|
+
\
|
290
|
+
result.a = z_2d_##type##_minimum(a, b); \
|
291
|
+
result.b = z_2d_##type##_maximum(a, b); \
|
292
|
+
return result; \
|
293
|
+
} \
|
294
|
+
\
|
295
|
+
\
|
296
|
+
static Z_INLINE \
|
297
|
+
ZAABR##Type z_aabr_##type##_grow_from_bottom_center(ZAABR##Type object, Z2D##Type delta) \
|
298
|
+
{ \
|
299
|
+
z##type size_x = object.b.x - object.a.x; \
|
300
|
+
\
|
301
|
+
object.b.x = (object.a.x -= delta.x / (z##type)2) + size_x + delta.x; \
|
302
|
+
object.b.y += delta.y; \
|
303
|
+
return object; \
|
304
|
+
} \
|
305
|
+
\
|
306
|
+
\
|
307
|
+
static Z_INLINE \
|
308
|
+
ZAABR##Type z_aabr_##type##_grow_from_bottom_left(ZAABR##Type object, Z2D##Type delta) \
|
309
|
+
{ \
|
310
|
+
object.b.x += delta.x; \
|
311
|
+
object.b.y += delta.y; \
|
312
|
+
return object; \
|
313
|
+
} \
|
314
|
+
\
|
315
|
+
\
|
316
|
+
static Z_INLINE \
|
317
|
+
ZAABR##Type z_aabr_##type##_grow_from_bottom_right(ZAABR##Type object, Z2D##Type delta) \
|
318
|
+
{ \
|
319
|
+
object.a.x -= delta.x; \
|
320
|
+
object.b.y += delta.y; \
|
321
|
+
return object; \
|
322
|
+
} \
|
323
|
+
\
|
324
|
+
\
|
325
|
+
static Z_INLINE \
|
326
|
+
ZAABR##Type z_aabr_##type##_grow_from_center(ZAABR##Type object, Z2D##Type delta) \
|
327
|
+
{ \
|
328
|
+
z##type size_x = object.b.x - object.a.x; \
|
329
|
+
z##type size_y = object.b.y - object.a.y; \
|
330
|
+
\
|
331
|
+
object.b.x = (object.a.x -= delta.x / (z##type)2) + size_x + delta.x; \
|
332
|
+
object.b.y = (object.a.y -= delta.y / (z##type)2) + size_y + delta.y; \
|
333
|
+
return object; \
|
334
|
+
} \
|
335
|
+
\
|
336
|
+
\
|
337
|
+
static Z_INLINE \
|
338
|
+
ZAABR##Type z_aabr_##type##_grow_from_center_left(ZAABR##Type object, Z2D##Type delta) \
|
339
|
+
{ \
|
340
|
+
z##type size_y = object.b.y - object.a.y; \
|
341
|
+
\
|
342
|
+
object.b.x += delta.x; \
|
343
|
+
object.b.y = (object.a.y -= delta.y / (z##type)2) + size_y + delta.y; \
|
344
|
+
return object; \
|
345
|
+
} \
|
346
|
+
\
|
347
|
+
\
|
348
|
+
static Z_INLINE \
|
349
|
+
ZAABR##Type z_aabr_##type##_grow_from_center_right(ZAABR##Type object, Z2D##Type delta) \
|
350
|
+
{ \
|
351
|
+
z##type size_y = object.b.y - object.a.y; \
|
352
|
+
\
|
353
|
+
object.a.x -= delta.x; \
|
354
|
+
object.b.y = (object.a.y -= delta.y / (z##type)2) + size_y + delta.y; \
|
355
|
+
return object; \
|
356
|
+
} \
|
357
|
+
\
|
358
|
+
\
|
359
|
+
static Z_INLINE \
|
360
|
+
ZAABR##Type z_aabr_##type##_grow_from_top_center(ZAABR##Type object, Z2D##Type delta) \
|
361
|
+
{ \
|
362
|
+
z##type size_x = object.b.x - object.a.x; \
|
363
|
+
\
|
364
|
+
object.b.x = (object.a.x -= delta.x / (z##type)2) + size_x + delta.x; \
|
365
|
+
object.a.y -= delta.y; \
|
366
|
+
return object; \
|
367
|
+
} \
|
368
|
+
\
|
369
|
+
\
|
370
|
+
static Z_INLINE \
|
371
|
+
ZAABR##Type z_aabr_##type##_grow_from_top_left(ZAABR##Type object, Z2D##Type delta) \
|
372
|
+
{ \
|
373
|
+
object.b.x += delta.x; \
|
374
|
+
object.a.y -= delta.y; \
|
375
|
+
return object; \
|
376
|
+
} \
|
377
|
+
\
|
378
|
+
\
|
379
|
+
static Z_INLINE \
|
380
|
+
ZAABR##Type z_aabr_##type##_grow_from_top_right(ZAABR##Type object, Z2D##Type delta) \
|
381
|
+
{ \
|
382
|
+
object.a.x -= delta.x; \
|
383
|
+
object.a.y -= delta.y; \
|
384
|
+
return object; \
|
385
|
+
} \
|
386
|
+
\
|
387
|
+
\
|
388
|
+
static Z_INLINE \
|
389
|
+
ZAABR##Type z_aabr_##type##_grow_in_x_from_center(ZAABR##Type object, z##type delta) \
|
390
|
+
{ \
|
391
|
+
z##type size_x = object.b.x - object.a.x; \
|
392
|
+
\
|
393
|
+
object.b.x = (object.a.x -= delta / (z##type)2) + size_x + delta; \
|
394
|
+
return object; \
|
395
|
+
} \
|
396
|
+
\
|
397
|
+
\
|
398
|
+
static Z_INLINE \
|
399
|
+
ZAABR##Type z_aabr_##type##_grow_in_x_from_left(ZAABR##Type object, z##type delta) \
|
400
|
+
{ \
|
401
|
+
object.b.x += delta; \
|
402
|
+
return object; \
|
403
|
+
} \
|
404
|
+
\
|
405
|
+
\
|
406
|
+
static Z_INLINE \
|
407
|
+
ZAABR##Type z_aabr_##type##_grow_in_x_from_right(ZAABR##Type object, z##type delta) \
|
408
|
+
{ \
|
409
|
+
object.a.x -= delta; \
|
410
|
+
return object; \
|
411
|
+
} \
|
412
|
+
\
|
413
|
+
\
|
414
|
+
static Z_INLINE \
|
415
|
+
ZAABR##Type z_aabr_##type##_grow_in_y_from_bottom(ZAABR##Type object, z##type delta) \
|
416
|
+
{ \
|
417
|
+
object.b.y += delta; \
|
418
|
+
return object; \
|
419
|
+
} \
|
420
|
+
\
|
421
|
+
\
|
422
|
+
static Z_INLINE \
|
423
|
+
ZAABR##Type z_aabr_##type##_grow_in_y_from_center(ZAABR##Type object, z##type delta) \
|
424
|
+
{ \
|
425
|
+
z##type size_y = object.b.y - object.a.y; \
|
426
|
+
\
|
427
|
+
object.b.y = (object.a.y -= delta / (z##type)2) + size_y + delta; \
|
428
|
+
return object; \
|
429
|
+
} \
|
430
|
+
\
|
431
|
+
\
|
432
|
+
static Z_INLINE \
|
433
|
+
ZAABR##Type z_aabr_##type##_grow_in_y_from_top(ZAABR##Type object, z##type delta) \
|
434
|
+
{ \
|
435
|
+
object.a.y -= delta; \
|
436
|
+
return object; \
|
437
|
+
} \
|
438
|
+
\
|
439
|
+
\
|
440
|
+
static Z_INLINE \
|
441
|
+
zboolean z_aabr_##type##_intersect(ZAABR##Type a, ZAABR##Type b) \
|
442
|
+
{ \
|
443
|
+
return a.a.x != a.b.x && a.a.y != a.b.y && b.a.x != b.b.x && b.a.y != b.b.y && \
|
444
|
+
b.b.x > a.a.x && b.b.y > a.a.y && b.a.x < a.b.x && b.a.y < a.b.y; \
|
445
|
+
} \
|
446
|
+
\
|
447
|
+
\
|
448
|
+
static Z_INLINE \
|
449
|
+
ZAABR##Type z_aabr_##type##_intersection(ZAABR##Type a, ZAABR##Type b) \
|
450
|
+
{ \
|
451
|
+
z##type x1, x2, y1, y2; \
|
452
|
+
\
|
453
|
+
return (x1 = z_##type##_maximum(a.a.x, b.a.x)) < \
|
454
|
+
(x2 = z_##type##_minimum(a.b.x, b.b.x)) && \
|
455
|
+
(y1 = z_##type##_maximum(a.a.y, b.a.y)) < \
|
456
|
+
(y2 = z_##type##_minimum(a.b.y, b.b.y)) \
|
457
|
+
\
|
458
|
+
? z_aabr_##type(x1, y1, x2, y2) \
|
459
|
+
: z_aabr_##type##_zero; \
|
460
|
+
} \
|
461
|
+
\
|
462
|
+
\
|
463
|
+
static Z_INLINE \
|
464
|
+
ZAABR##Type z_aabr_##type##_left_half(ZAABR##Type object) \
|
465
|
+
{ \
|
466
|
+
object.b.x = (object.a.x + object.b.x) / (z##type)2; \
|
467
|
+
return object; \
|
468
|
+
} \
|
469
|
+
\
|
470
|
+
\
|
471
|
+
static Z_INLINE \
|
472
|
+
z##type z_aabr_##type##_maximum_x(ZAABR##Type object) \
|
473
|
+
{return object.b.x;} \
|
474
|
+
\
|
475
|
+
\
|
476
|
+
static Z_INLINE \
|
477
|
+
z##type z_aabr_##type##_maximum_y(ZAABR##Type object) \
|
478
|
+
{return object.b.y;} \
|
479
|
+
\
|
480
|
+
\
|
481
|
+
static Z_INLINE \
|
482
|
+
z##type z_aabr_##type##_middle_x(ZAABR##Type object) \
|
483
|
+
{return (object.a.x + object.b.x) / (z##type)2;} \
|
484
|
+
\
|
485
|
+
\
|
486
|
+
static Z_INLINE \
|
487
|
+
z##type z_aabr_##type##_middle_y(ZAABR##Type object) \
|
488
|
+
{return (object.a.y + object.b.y) / (z##type)2;} \
|
489
|
+
\
|
490
|
+
\
|
491
|
+
static Z_INLINE \
|
492
|
+
z##type z_aabr_##type##_minimum_x(ZAABR##Type object) \
|
493
|
+
{return object.a.x;} \
|
494
|
+
\
|
495
|
+
\
|
496
|
+
static Z_INLINE \
|
497
|
+
z##type z_aabr_##type##_minimum_y(ZAABR##Type object) \
|
498
|
+
{return object.a.y;} \
|
499
|
+
\
|
500
|
+
\
|
501
|
+
static Z_INLINE \
|
502
|
+
ZRectangle##Type z_aabr_##type##_rectangle(ZAABR##Type object) \
|
503
|
+
{ \
|
504
|
+
return z_rectangle_##type \
|
505
|
+
(object.a.x, object.a.y, object.b.x - object.a.x, object.b.y - object.a.y); \
|
506
|
+
} \
|
507
|
+
\
|
508
|
+
\
|
509
|
+
static Z_INLINE \
|
510
|
+
ZAABR##Type z_aabr_##type##_right_half(ZAABR##Type object) \
|
511
|
+
{ \
|
512
|
+
object.a.x = (object.a.x + object.b.x) / (z##type)2; \
|
513
|
+
return object; \
|
514
|
+
} \
|
515
|
+
\
|
516
|
+
\
|
517
|
+
static Z_INLINE \
|
518
|
+
ZAABR##Type z_aabr_##type##_shrink_from_bottom_center(ZAABR##Type object, Z2D##Type delta) \
|
519
|
+
{ \
|
520
|
+
z##type size_x = object.b.x - object.a.x; \
|
521
|
+
\
|
522
|
+
object.b.x = (object.a.x += delta.x / (z##type)2) + size_x - delta.x; \
|
523
|
+
object.b.y -= delta.y; \
|
524
|
+
return object; \
|
525
|
+
} \
|
526
|
+
\
|
527
|
+
\
|
528
|
+
static Z_INLINE \
|
529
|
+
ZAABR##Type z_aabr_##type##_shrink_from_bottom_left(ZAABR##Type object, Z2D##Type delta) \
|
530
|
+
{ \
|
531
|
+
object.b.x -= delta.x; \
|
532
|
+
object.b.y -= delta.y; \
|
533
|
+
return object; \
|
534
|
+
} \
|
535
|
+
\
|
536
|
+
\
|
537
|
+
static Z_INLINE \
|
538
|
+
ZAABR##Type z_aabr_##type##_shrink_from_bottom_right(ZAABR##Type object,Z2D##Type delta) \
|
539
|
+
{ \
|
540
|
+
object.a.x += delta.x; \
|
541
|
+
object.b.y -= delta.y; \
|
542
|
+
return object; \
|
543
|
+
} \
|
544
|
+
\
|
545
|
+
\
|
546
|
+
static Z_INLINE \
|
547
|
+
ZAABR##Type z_aabr_##type##_shrink_from_center(ZAABR##Type object, Z2D##Type delta) \
|
548
|
+
{ \
|
549
|
+
z##type size_x = object.b.x - object.a.x; \
|
550
|
+
z##type size_y = object.b.y - object.a.y; \
|
551
|
+
\
|
552
|
+
object.b.x = (object.a.x += delta.x / (z##type)2) + size_x - delta.x; \
|
553
|
+
object.b.y = (object.a.y += delta.y / (z##type)2) + size_y - delta.y; \
|
554
|
+
return object; \
|
555
|
+
} \
|
556
|
+
\
|
557
|
+
\
|
558
|
+
static Z_INLINE \
|
559
|
+
ZAABR##Type z_aabr_##type##_shrink_from_center_left(ZAABR##Type object, Z2D##Type delta) \
|
560
|
+
{ \
|
561
|
+
z##type size_y = object.b.y - object.a.y; \
|
562
|
+
\
|
563
|
+
object.b.x -= delta.x; \
|
564
|
+
object.b.y = (object.a.y += delta.y / (z##type)2) + size_y - delta.y; \
|
565
|
+
return object; \
|
566
|
+
} \
|
567
|
+
\
|
568
|
+
\
|
569
|
+
static Z_INLINE \
|
570
|
+
ZAABR##Type z_aabr_##type##_shrink_from_center_right(ZAABR##Type object, Z2D##Type delta) \
|
571
|
+
{ \
|
572
|
+
z##type size_y = object.b.y - object.a.y; \
|
573
|
+
\
|
574
|
+
object.a.x += delta.x; \
|
575
|
+
object.b.y = (object.a.y += delta.y / (z##type)2) + size_y - delta.y; \
|
576
|
+
return object; \
|
577
|
+
} \
|
578
|
+
\
|
579
|
+
\
|
580
|
+
static Z_INLINE \
|
581
|
+
ZAABR##Type z_aabr_##type##_shrink_from_top_center(ZAABR##Type object, Z2D##Type delta) \
|
582
|
+
{ \
|
583
|
+
z##type size_x = object.b.x - object.a.x; \
|
584
|
+
\
|
585
|
+
object.b.x = (object.a.x += delta.x / (z##type)2) + size_x - delta.x; \
|
586
|
+
object.a.y += delta.y; \
|
587
|
+
return object; \
|
588
|
+
} \
|
589
|
+
\
|
590
|
+
\
|
591
|
+
static Z_INLINE \
|
592
|
+
ZAABR##Type z_aabr_##type##_shrink_from_top_left(ZAABR##Type object, Z2D##Type delta) \
|
593
|
+
{ \
|
594
|
+
object.b.x -= delta.x; \
|
595
|
+
object.a.y += delta.y; \
|
596
|
+
return object; \
|
597
|
+
} \
|
598
|
+
\
|
599
|
+
\
|
600
|
+
static Z_INLINE \
|
601
|
+
ZAABR##Type z_aabr_##type##_shrink_from_top_right(ZAABR##Type object, Z2D##Type delta) \
|
602
|
+
{ \
|
603
|
+
object.a.x += delta.x; \
|
604
|
+
object.a.y += delta.y; \
|
605
|
+
return object; \
|
606
|
+
} \
|
607
|
+
\
|
608
|
+
\
|
609
|
+
static Z_INLINE \
|
610
|
+
ZAABR##Type z_aabr_##type##_shrink_in_x_from_center(ZAABR##Type object, z##type delta) \
|
611
|
+
{ \
|
612
|
+
z##type size_x = object.b.x - object.a.x; \
|
613
|
+
\
|
614
|
+
object.b.x = (object.a.x += delta / (z##type)2) + size_x - delta; \
|
615
|
+
return object; \
|
616
|
+
} \
|
617
|
+
\
|
618
|
+
\
|
619
|
+
static Z_INLINE \
|
620
|
+
ZAABR##Type z_aabr_##type##_shrink_in_x_from_left(ZAABR##Type object, z##type delta) \
|
621
|
+
{ \
|
622
|
+
object.b.x -= delta; \
|
623
|
+
return object; \
|
624
|
+
} \
|
625
|
+
\
|
626
|
+
\
|
627
|
+
static Z_INLINE \
|
628
|
+
ZAABR##Type z_aabr_##type##_shrink_in_x_from_right(ZAABR##Type object, z##type delta) \
|
629
|
+
{ \
|
630
|
+
object.a.x += delta; \
|
631
|
+
return object; \
|
632
|
+
} \
|
633
|
+
\
|
634
|
+
\
|
635
|
+
static Z_INLINE \
|
636
|
+
ZAABR##Type z_aabr_##type##_shrink_in_y_from_bottom(ZAABR##Type object, z##type delta) \
|
637
|
+
{ \
|
638
|
+
object.b.y -= delta; \
|
639
|
+
return object; \
|
640
|
+
} \
|
641
|
+
\
|
642
|
+
\
|
643
|
+
static Z_INLINE \
|
644
|
+
ZAABR##Type z_aabr_##type##_shrink_in_y_from_center(ZAABR##Type object, z##type delta) \
|
645
|
+
{ \
|
646
|
+
z##type size_y = object.b.y - object.a.y; \
|
647
|
+
\
|
648
|
+
object.b.y = (object.a.y += delta / (z##type)2) + size_y - delta; \
|
649
|
+
return object; \
|
650
|
+
} \
|
651
|
+
\
|
652
|
+
\
|
653
|
+
static Z_INLINE \
|
654
|
+
ZAABR##Type z_aabr_##type##_shrink_in_y_from_top(ZAABR##Type object, z##type delta) \
|
655
|
+
{ \
|
656
|
+
object.a.y += delta; \
|
657
|
+
return object; \
|
658
|
+
} \
|
659
|
+
\
|
660
|
+
\
|
661
|
+
static Z_INLINE \
|
662
|
+
Z2D##Type z_aabr_##type##_top_center(ZAABR##Type object) \
|
663
|
+
{return z_2d_##type((object.a.x + object.b.x) / (z##type)2, object.b.y);} \
|
664
|
+
\
|
665
|
+
\
|
666
|
+
static Z_INLINE \
|
667
|
+
ZAABR##Type z_aabr_##type##_top_half(ZAABR##Type object) \
|
668
|
+
{ \
|
669
|
+
object.a.y = (object.a.y + object.b.y) / (z##type)2; \
|
670
|
+
return object; \
|
671
|
+
} \
|
672
|
+
\
|
673
|
+
\
|
674
|
+
static Z_INLINE \
|
675
|
+
Z2D##Type z_aabr_##type##_top_left(ZAABR##Type object) \
|
676
|
+
{return z_2d_##type(object.a.x, object.b.y);} \
|
677
|
+
\
|
678
|
+
\
|
679
|
+
static Z_INLINE \
|
680
|
+
ZAABR##Type z_aabr_##type##_top_left_quarter(ZAABR##Type object) \
|
681
|
+
{ \
|
682
|
+
object.b.x = (object.a.x + object.b.x) / (z##type)2; \
|
683
|
+
object.a.y = (object.a.y + object.b.y) / (z##type)2; \
|
684
|
+
return object; \
|
685
|
+
} \
|
686
|
+
\
|
687
|
+
\
|
688
|
+
static Z_INLINE \
|
689
|
+
Z2D##Type z_aabr_##type##_top_right(ZAABR##Type object) \
|
690
|
+
{return object.b;} \
|
691
|
+
\
|
692
|
+
\
|
693
|
+
static Z_INLINE \
|
694
|
+
ZAABR##Type z_aabr_##type##_top_right_quarter(ZAABR##Type object) \
|
695
|
+
{ \
|
696
|
+
object.a.x = (object.a.x + object.b.x) / (z##type)2; \
|
697
|
+
object.a.y = (object.a.y + object.b.y) / (z##type)2; \
|
698
|
+
return object; \
|
699
|
+
} \
|
700
|
+
\
|
701
|
+
\
|
702
|
+
static Z_INLINE \
|
703
|
+
ZAABR##Type z_aabr_##type##_union(ZAABR##Type a, ZAABR##Type b) \
|
704
|
+
{ \
|
705
|
+
ZAABR##Type result; \
|
706
|
+
\
|
707
|
+
result.a = z_2d_##type##_minimum(a.a, b.a); \
|
708
|
+
result.b = z_2d_##type##_maximum(a.b, b.b); \
|
709
|
+
return result; \
|
710
|
+
}
|
711
|
+
|
712
|
+
|
713
|
+
#define z_aabr_type_align_in_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_bottom_center )
|
714
|
+
#define z_aabr_type_align_in_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_bottom_left )
|
715
|
+
#define z_aabr_type_align_in_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_bottom_right )
|
716
|
+
#define z_aabr_type_align_in_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_center )
|
717
|
+
#define z_aabr_type_align_in_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_center_left )
|
718
|
+
#define z_aabr_type_align_in_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_center_right )
|
719
|
+
#define z_aabr_type_align_in_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_top_center )
|
720
|
+
#define z_aabr_type_align_in_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_top_left )
|
721
|
+
#define z_aabr_type_align_in_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _align_in_top_right )
|
722
|
+
#define z_aabr_type_area( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _area )
|
723
|
+
#define z_aabr_type_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _bottom_center )
|
724
|
+
#define z_aabr_type_bottom_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _bottom_half )
|
725
|
+
#define z_aabr_type_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _bottom_left )
|
726
|
+
#define z_aabr_type_bottom_left_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _bottom_left_quarter )
|
727
|
+
#define z_aabr_type_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _bottom_right )
|
728
|
+
#define z_aabr_type_bottom_right_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _bottom_right_quarter )
|
729
|
+
#define z_aabr_type_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _center_left )
|
730
|
+
#define z_aabr_type_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _center_right )
|
731
|
+
#define z_aabr_type_contains( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _contains )
|
732
|
+
#define z_aabr_type_contains_point( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _contains_point )
|
733
|
+
#define z_aabr_type_contains_rectangle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _contains_rectangle )
|
734
|
+
#define z_aabr_type_fit_in_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_bottom_center )
|
735
|
+
#define z_aabr_type_fit_in_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_bottom_left )
|
736
|
+
#define z_aabr_type_fit_in_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_bottom_right )
|
737
|
+
#define z_aabr_type_fit_in_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_center )
|
738
|
+
#define z_aabr_type_fit_in_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_center_left )
|
739
|
+
#define z_aabr_type_fit_in_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_center_right )
|
740
|
+
#define z_aabr_type_fit_in_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_top_center )
|
741
|
+
#define z_aabr_type_fit_in_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_top_left )
|
742
|
+
#define z_aabr_type_fit_in_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _fit_in_top_right )
|
743
|
+
#define z_aabr_type_from_vertices( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _from_vertices )
|
744
|
+
#define z_aabr_type_grow_from_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_bottom_center )
|
745
|
+
#define z_aabr_type_grow_from_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_bottom_left )
|
746
|
+
#define z_aabr_type_grow_from_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_bottom_right )
|
747
|
+
#define z_aabr_type_grow_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_center )
|
748
|
+
#define z_aabr_type_grow_from_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_center_left )
|
749
|
+
#define z_aabr_type_grow_from_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_center_right )
|
750
|
+
#define z_aabr_type_grow_from_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_top_center )
|
751
|
+
#define z_aabr_type_grow_from_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_top_left )
|
752
|
+
#define z_aabr_type_grow_from_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_from_top_right )
|
753
|
+
#define z_aabr_type_grow_in_x_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_in_x_from_center )
|
754
|
+
#define z_aabr_type_grow_in_x_from_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_in_x_from_left )
|
755
|
+
#define z_aabr_type_grow_in_x_from_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_in_x_from_right )
|
756
|
+
#define z_aabr_type_grow_in_y_from_bottom( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_in_y_from_bottom )
|
757
|
+
#define z_aabr_type_grow_in_y_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_in_y_from_center )
|
758
|
+
#define z_aabr_type_grow_in_y_from_top( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _grow_in_y_from_top )
|
759
|
+
#define z_aabr_type_intersect( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _intersect )
|
760
|
+
#define z_aabr_type_intersection( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _intersection )
|
761
|
+
#define z_aabr_type_left_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _left_half )
|
762
|
+
#define z_aabr_type_maximum_x( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _maximum_x )
|
763
|
+
#define z_aabr_type_maximum_y( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _maximum_y )
|
764
|
+
#define z_aabr_type_middle_x( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _middle_x )
|
765
|
+
#define z_aabr_type_middle_y( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _middle_y )
|
766
|
+
#define z_aabr_type_minimum_x( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _minimum_x )
|
767
|
+
#define z_aabr_type_minimum_y( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _minimum_y )
|
768
|
+
#define z_aabr_type_rectangle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _rectangle )
|
769
|
+
#define z_aabr_type_right_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _right_half )
|
770
|
+
#define z_aabr_type_size( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _size )
|
771
|
+
#define z_abbr_type_shrink_from_bottom_center(TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_bottom_center)
|
772
|
+
#define z_abbr_type_shrink_from_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_bottom_left )
|
773
|
+
#define z_abbr_type_shrink_from_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_bottom_right )
|
774
|
+
#define z_abbr_type_shrink_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_center )
|
775
|
+
#define z_abbr_type_shrink_from_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_center_left )
|
776
|
+
#define z_abbr_type_shrink_from_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_center_right )
|
777
|
+
#define z_abbr_type_shrink_from_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_top_center )
|
778
|
+
#define z_abbr_type_shrink_from_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_top_left )
|
779
|
+
#define z_abbr_type_shrink_from_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_from_top_right )
|
780
|
+
#define z_abbr_type_shrink_in_x_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_in_x_from_center )
|
781
|
+
#define z_abbr_type_shrink_in_x_from_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_in_x_from_left )
|
782
|
+
#define z_abbr_type_shrink_in_x_from_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_in_x_from_right )
|
783
|
+
#define z_abbr_type_shrink_in_y_from_bottom( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_in_y_from_bottom )
|
784
|
+
#define z_abbr_type_shrink_in_y_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_in_y_from_center )
|
785
|
+
#define z_abbr_type_shrink_in_y_from_top( TYPE) Z_INSERT_##TYPE##_fixed_type(z_abbr_, _shrink_in_y_from_top )
|
786
|
+
#define z_aabr_type_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _top_center )
|
787
|
+
#define z_aabr_type_top_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _top_half )
|
788
|
+
#define z_aabr_type_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _top_left )
|
789
|
+
#define z_aabr_type_top_left_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _top_left_quarter )
|
790
|
+
#define z_aabr_type_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _top_right )
|
791
|
+
#define z_aabr_type_top_right_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _top_right_quarter )
|
792
|
+
#define z_aabr_type_union( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _union )
|
793
|
+
|
794
|
+
|
795
|
+
/* MARK: - Partial implementation for real types */
|
796
|
+
|
797
|
+
|
798
|
+
#define Z_IMPLEMENTATION_REAL(Type, type) \
|
799
|
+
\
|
800
|
+
static Z_INLINE \
|
801
|
+
Z2D##Type z_aabr_##type##_absolute_point_to_unit(ZAABR##Type object, Z2D##Type point) \
|
802
|
+
{ \
|
803
|
+
return z_2d_##type \
|
804
|
+
((point.x - object.a.x) / (object.b.x - object.a.x), \
|
805
|
+
(point.y - object.a.y) / (object.b.y - object.a.y)); \
|
806
|
+
} \
|
807
|
+
\
|
808
|
+
\
|
809
|
+
static Z_INLINE \
|
810
|
+
zboolean z_aabr_##type##_contains_circle(ZAABR##Type object, ZCircle##Type circle) \
|
811
|
+
{ \
|
812
|
+
return circle.point.x - circle.radius >= object.a.x && \
|
813
|
+
circle.point.y - circle.radius >= object.a.y && \
|
814
|
+
circle.point.x + circle.radius <= object.b.x && \
|
815
|
+
circle.point.y + circle.radius <= object.b.y; \
|
816
|
+
} \
|
817
|
+
\
|
818
|
+
\
|
819
|
+
static Z_INLINE \
|
820
|
+
ZCircle##Type z_aabr_##type##_inner_circle(ZAABR##Type object) \
|
821
|
+
{ \
|
822
|
+
ZCircle##Type result; \
|
823
|
+
\
|
824
|
+
result.point = z_aabr_##type##_center(object); \
|
825
|
+
\
|
826
|
+
result.radius = \
|
827
|
+
z_2d_##type##_inner_minimum(z_2d_##type##_subtract(object.b, object.a)) / (z##type)2; \
|
828
|
+
\
|
829
|
+
return result; \
|
830
|
+
} \
|
831
|
+
\
|
832
|
+
\
|
833
|
+
static Z_INLINE \
|
834
|
+
Z2D##Type z_aabr_##type##_unit_point_to_absolute(ZAABR##Type object, Z2D##Type point) \
|
835
|
+
{ \
|
836
|
+
return z_2d_##type \
|
837
|
+
(point.x * (object.b.x - object.a.x) + object.a.x, \
|
838
|
+
point.y * (object.b.y - object.a.y) + object.a.y); \
|
839
|
+
}
|
840
|
+
|
841
|
+
|
842
|
+
#define z_aabr_type_absolute_point_to_unit(TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _absolute_point_to_unit)
|
843
|
+
#define z_aabr_type_contains_circle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _contains_circle )
|
844
|
+
#define z_aabr_type_inner_circle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _inner_circle )
|
845
|
+
#define z_aabr_type_unit_point_to_absolute(TYPE) Z_INSERT_##TYPE##_fixed_type(z_aabr_, _unit_point_to_absolute)
|
846
|
+
|
847
|
+
|
848
|
+
/* MARK: - Implementation expansions */
|
849
|
+
|
850
|
+
|
851
|
+
#define z_aabr_sint8_are_equal z_2d_line_sint8_are_equal
|
852
|
+
#define z_aabr_sint8_center z_2d_line_segment_sint8_center
|
853
|
+
#define z_aabr_sint8_is_zero z_2d_line_sint8_is_zero
|
854
|
+
#define z_aabr_sint8_swap z_2d_line_sint8_swap
|
855
|
+
|
856
|
+
Z_IMPLEMENTATION_COMMON(SInt8, sint8)
|
857
|
+
|
858
|
+
#define z_aabr_sint16_are_equal z_2d_line_sint16_are_equal
|
859
|
+
#define z_aabr_sint16_center z_2d_line_segment_sint16_center
|
860
|
+
#define z_aabr_sint16_is_zero z_2d_line_sint16_is_zero
|
861
|
+
#define z_aabr_sint16_swap z_2d_line_sint16_swap
|
862
|
+
|
863
|
+
Z_IMPLEMENTATION_COMMON(SInt16, sint16)
|
864
|
+
|
865
|
+
#define z_aabr_sint32_are_equal z_2d_line_sint32_are_equal
|
866
|
+
#define z_aabr_sint32_center z_2d_line_segment_sint32_center
|
867
|
+
#define z_aabr_sint32_is_zero z_2d_line_sint32_is_zero
|
868
|
+
#define z_aabr_sint32_swap z_2d_line_sint32_swap
|
869
|
+
|
870
|
+
Z_IMPLEMENTATION_COMMON(SInt32, sint32)
|
871
|
+
|
872
|
+
#ifdef Z_SINT64
|
873
|
+
|
874
|
+
# define z_aabr_sint64_are_equal z_2d_line_sint64_are_equal
|
875
|
+
# define z_aabr_sint64_center z_2d_line_segment_sint64_center
|
876
|
+
# define z_aabr_sint64_is_zero z_2d_line_sint64_is_zero
|
877
|
+
# define z_aabr_sint64_swap z_2d_line_sint64_swap
|
878
|
+
|
879
|
+
Z_IMPLEMENTATION_COMMON(SInt64, sint64)
|
880
|
+
|
881
|
+
#endif
|
882
|
+
|
883
|
+
#ifdef Z_SINT128
|
884
|
+
|
885
|
+
# define z_aabr_sint128_are_equal z_2d_line_sint128_are_equal
|
886
|
+
# define z_aabr_sint128_center z_2d_line_segment_sint128_center
|
887
|
+
# define z_aabr_sint128_is_zero z_2d_line_sint128_is_zero
|
888
|
+
# define z_aabr_sint128_swap z_2d_line_sint128_swap
|
889
|
+
|
890
|
+
Z_IMPLEMENTATION_COMMON(SInt128, sint128)
|
891
|
+
|
892
|
+
#endif
|
893
|
+
|
894
|
+
#ifdef Z_FLOAT16
|
895
|
+
|
896
|
+
# define z_aabr_float16_are_equal z_2d_line_float16_are_equal
|
897
|
+
# define z_aabr_float16_center z_2d_line_segment_float16_center
|
898
|
+
# define z_aabr_float16_is_zero z_2d_line_float16_is_zero
|
899
|
+
# define z_aabr_float16_swap z_2d_line_float16_swap
|
900
|
+
|
901
|
+
Z_IMPLEMENTATION_COMMON(Float16, float16)
|
902
|
+
Z_IMPLEMENTATION_REAL (Float16, float16)
|
903
|
+
|
904
|
+
#endif
|
905
|
+
|
906
|
+
#ifdef Z_FLOAT32
|
907
|
+
|
908
|
+
# define z_aabr_float32_are_equal z_2d_line_float32_are_equal
|
909
|
+
# define z_aabr_float32_center z_2d_line_segment_float32_center
|
910
|
+
# define z_aabr_float32_is_zero z_2d_line_float32_is_zero
|
911
|
+
# define z_aabr_float32_swap z_2d_line_float32_swap
|
912
|
+
|
913
|
+
Z_IMPLEMENTATION_COMMON(Float32, float32)
|
914
|
+
Z_IMPLEMENTATION_REAL (Float32, float32)
|
915
|
+
|
916
|
+
#endif
|
917
|
+
|
918
|
+
#ifdef Z_FLOAT64
|
919
|
+
|
920
|
+
# define z_aabr_float64_are_equal z_2d_line_float64_are_equal
|
921
|
+
# define z_aabr_float64_center z_2d_line_segment_float64_center
|
922
|
+
# define z_aabr_float64_is_zero z_2d_line_float64_is_zero
|
923
|
+
# define z_aabr_float64_swap z_2d_line_float64_swap
|
924
|
+
|
925
|
+
Z_IMPLEMENTATION_COMMON(Float64, float64)
|
926
|
+
Z_IMPLEMENTATION_REAL (Float64, float64)
|
927
|
+
|
928
|
+
#endif
|
929
|
+
|
930
|
+
#ifdef Z_FLOAT128
|
931
|
+
|
932
|
+
# define z_aabr_float128_are_equal z_2d_line_float128_are_equal
|
933
|
+
# define z_aabr_float128_center z_2d_line_segment_float128_center
|
934
|
+
# define z_aabr_float128_is_zero z_2d_line_float128_is_zero
|
935
|
+
# define z_aabr_float128_swap z_2d_line_float128_swap
|
936
|
+
|
937
|
+
Z_IMPLEMENTATION_COMMON(Float128, float128)
|
938
|
+
Z_IMPLEMENTATION_REAL (Float128, float128)
|
939
|
+
|
940
|
+
#endif
|
941
|
+
|
942
|
+
#ifdef Z_FLOAT80_X87
|
943
|
+
|
944
|
+
# define z_aabr_float80_x87_are_equal z_2d_line_float80_x87_are_equal
|
945
|
+
# define z_aabr_float80_x87_center z_2d_line_segment_float80_x87_center
|
946
|
+
# define z_aabr_float80_x87_is_zero z_2d_line_float80_x87_is_zero
|
947
|
+
# define z_aabr_float80_x87_swap z_2d_line_float80_x87_swap
|
948
|
+
|
949
|
+
Z_IMPLEMENTATION_COMMON(Float80_x87, float80_x87)
|
950
|
+
Z_IMPLEMENTATION_REAL (Float80_x87, float80_x87)
|
951
|
+
|
952
|
+
#endif
|
953
|
+
|
954
|
+
#ifdef Z_FLOAT96_X87
|
955
|
+
|
956
|
+
# define z_aabr_float96_x87_are_equal z_2d_line_float96_x87_are_equal
|
957
|
+
# define z_aabr_float96_x87_center z_2d_line_segment_float96_x87_center
|
958
|
+
# define z_aabr_float96_x87_is_zero z_2d_line_float96_x87_is_zero
|
959
|
+
# define z_aabr_float96_x87_swap z_2d_line_float96_x87_swap
|
960
|
+
|
961
|
+
Z_IMPLEMENTATION_COMMON(Float96_x87, float96_x87)
|
962
|
+
Z_IMPLEMENTATION_REAL (Float96_x87, float96_x87)
|
963
|
+
|
964
|
+
#endif
|
965
|
+
|
966
|
+
#ifdef Z_FLOAT128_X87
|
967
|
+
|
968
|
+
# define z_aabr_float128_x87_are_equal z_2d_line_float128_x87_are_equal
|
969
|
+
# define z_aabr_float128_x87_center z_2d_line_segment_float128_x87_center
|
970
|
+
# define z_aabr_float128_x87_is_zero z_2d_line_float128_x87_is_zero
|
971
|
+
# define z_aabr_float128_x87_swap z_2d_line_float128_x87_swap
|
972
|
+
|
973
|
+
Z_IMPLEMENTATION_COMMON(Float128_x87, float128_x87)
|
974
|
+
Z_IMPLEMENTATION_REAL (Float128_x87, float128_x87)
|
975
|
+
|
976
|
+
#endif
|
977
|
+
|
978
|
+
|
979
|
+
/* MARK: - Cleanup */
|
980
|
+
|
981
|
+
|
982
|
+
#undef Z_IMPLEMENTATION_COMMON
|
983
|
+
#undef Z_IMPLEMENTATION_REAL
|
984
|
+
|
985
|
+
|
986
|
+
/* MARK: - Default real type definitions */
|
987
|
+
|
988
|
+
|
989
|
+
#ifdef Z_REAL
|
990
|
+
# define z_aabr_absolute_point_to_unit z_aabr_type_absolute_point_to_unit (REAL)
|
991
|
+
# define z_aabr_align_in_bottom_center z_aabr_type_align_in_bottom_center (REAL)
|
992
|
+
# define z_aabr_align_in_bottom_left z_aabr_type_align_in_bottom_left (REAL)
|
993
|
+
# define z_aabr_align_in_bottom_right z_aabr_type_align_in_bottom_right (REAL)
|
994
|
+
# define z_aabr_align_in_center z_aabr_type_align_in_center (REAL)
|
995
|
+
# define z_aabr_align_in_center_left z_aabr_type_align_in_center_left (REAL)
|
996
|
+
# define z_aabr_align_in_center_right z_aabr_type_align_in_center_right (REAL)
|
997
|
+
# define z_aabr_align_in_top_center z_aabr_type_align_in_top_center (REAL)
|
998
|
+
# define z_aabr_align_in_top_left z_aabr_type_align_in_top_left (REAL)
|
999
|
+
# define z_aabr_align_in_top_right z_aabr_type_align_in_top_right (REAL)
|
1000
|
+
# define z_aabr_are_equal z_2d_line_are_equal
|
1001
|
+
# define z_aabr_area z_aabr_type_area (REAL)
|
1002
|
+
# define z_aabr_bottom_center z_aabr_type_bottom_center (REAL)
|
1003
|
+
# define z_aabr_bottom_half z_aabr_type_bottom_half (REAL)
|
1004
|
+
# define z_aabr_bottom_left z_aabr_type_bottom_left (REAL)
|
1005
|
+
# define z_aabr_bottom_left_quarter z_aabr_type_bottom_left_quarter (REAL)
|
1006
|
+
# define z_aabr_bottom_right z_aabr_type_bottom_right (REAL)
|
1007
|
+
# define z_aabr_bottom_right_quarter z_aabr_type_bottom_right_quarter (REAL)
|
1008
|
+
# define z_aabr_center z_2d_line_segment_center
|
1009
|
+
# define z_aabr_center_left z_aabr_type_center_left (REAL)
|
1010
|
+
# define z_aabr_center_right z_aabr_type_center_right (REAL)
|
1011
|
+
# define z_aabr_contains z_aabr_type_contains (REAL)
|
1012
|
+
# define z_aabr_contains_circle z_aabr_type_contains_circle (REAL)
|
1013
|
+
# define z_aabr_contains_point z_aabr_type_contains_point (REAL)
|
1014
|
+
# define z_aabr_contains_rectangle z_aabr_type_contains_rectangle (REAL)
|
1015
|
+
# define z_aabr_fit_in_bottom_center z_aabr_type_fit_in_bottom_center (REAL)
|
1016
|
+
# define z_aabr_fit_in_bottom_left z_aabr_type_fit_in_bottom_left (REAL)
|
1017
|
+
# define z_aabr_fit_in_bottom_right z_aabr_type_fit_in_bottom_right (REAL)
|
1018
|
+
# define z_aabr_fit_in_center z_aabr_type_fit_in_center (REAL)
|
1019
|
+
# define z_aabr_fit_in_center_left z_aabr_type_fit_in_center_left (REAL)
|
1020
|
+
# define z_aabr_fit_in_center_right z_aabr_type_fit_in_center_right (REAL)
|
1021
|
+
# define z_aabr_fit_in_top_center z_aabr_type_fit_in_top_center (REAL)
|
1022
|
+
# define z_aabr_fit_in_top_left z_aabr_type_fit_in_top_left (REAL)
|
1023
|
+
# define z_aabr_fit_in_top_right z_aabr_type_fit_in_top_right (REAL)
|
1024
|
+
# define z_aabr_from_vertices z_aabr_type_from_vertices (REAL)
|
1025
|
+
# define z_aabr_grow_from_bottom_center z_aabr_type_grow_from_bottom_center (REAL)
|
1026
|
+
# define z_aabr_grow_from_bottom_left z_aabr_type_grow_from_bottom_left (REAL)
|
1027
|
+
# define z_aabr_grow_from_bottom_right z_aabr_type_grow_from_bottom_right (REAL)
|
1028
|
+
# define z_aabr_grow_from_center z_aabr_type_grow_from_center (REAL)
|
1029
|
+
# define z_aabr_grow_from_center_left z_aabr_type_grow_from_center_left (REAL)
|
1030
|
+
# define z_aabr_grow_from_center_right z_aabr_type_grow_from_center_right (REAL)
|
1031
|
+
# define z_aabr_grow_from_top_center z_aabr_type_grow_from_top_center (REAL)
|
1032
|
+
# define z_aabr_grow_from_top_left z_aabr_type_grow_from_top_left (REAL)
|
1033
|
+
# define z_aabr_grow_from_top_right z_aabr_type_grow_from_top_right (REAL)
|
1034
|
+
# define z_aabr_grow_in_x_from_center z_aabr_type_grow_in_x_from_center (REAL)
|
1035
|
+
# define z_aabr_grow_in_x_from_left z_aabr_type_grow_in_x_from_left (REAL)
|
1036
|
+
# define z_aabr_grow_in_x_from_right z_aabr_type_grow_in_x_from_right (REAL)
|
1037
|
+
# define z_aabr_grow_in_y_from_bottom z_aabr_type_grow_in_y_from_bottom (REAL)
|
1038
|
+
# define z_aabr_grow_in_y_from_center z_aabr_type_grow_in_y_from_center (REAL)
|
1039
|
+
# define z_aabr_grow_in_y_from_top z_aabr_type_grow_in_y_from_top (REAL)
|
1040
|
+
# define z_aabr_inner_circle z_aabr_type_inner_circle (REAL)
|
1041
|
+
# define z_aabr_intersect z_aabr_type_intersect (REAL)
|
1042
|
+
# define z_aabr_intersection z_aabr_type_intersection (REAL)
|
1043
|
+
# define z_aabr_is_zero z_2d_line_is_zero
|
1044
|
+
# define z_aabr_left_half z_aabr_type_left_half (REAL)
|
1045
|
+
# define z_aabr_maximum_x z_aabr_type_maximum_x (REAL)
|
1046
|
+
# define z_aabr_maximum_y z_aabr_type_maximum_y (REAL)
|
1047
|
+
# define z_aabr_middle_x z_aabr_type_middle_x (REAL)
|
1048
|
+
# define z_aabr_middle_y z_aabr_type_middle_y (REAL)
|
1049
|
+
# define z_aabr_minimum_x z_aabr_type_minimum_x (REAL)
|
1050
|
+
# define z_aabr_minimum_y z_aabr_type_minimum_y (REAL)
|
1051
|
+
# define z_aabr_rectangle z_aabr_type_rectangle (REAL)
|
1052
|
+
# define z_aabr_right_half z_aabr_type_right_half (REAL)
|
1053
|
+
# define z_aabr_size z_aabr_type_size (REAL)
|
1054
|
+
# define z_abbr_shrink_from_bottom_center z_abbr_type_shrink_from_bottom_center(REAL)
|
1055
|
+
# define z_abbr_shrink_from_bottom_left z_abbr_type_shrink_from_bottom_left (REAL)
|
1056
|
+
# define z_abbr_shrink_from_bottom_right z_abbr_type_shrink_from_bottom_right (REAL)
|
1057
|
+
# define z_abbr_shrink_from_center z_abbr_type_shrink_from_center (REAL)
|
1058
|
+
# define z_abbr_shrink_from_center_left z_abbr_type_shrink_from_center_left (REAL)
|
1059
|
+
# define z_abbr_shrink_from_center_right z_abbr_type_shrink_from_center_right (REAL)
|
1060
|
+
# define z_abbr_shrink_from_top_center z_abbr_type_shrink_from_top_center (REAL)
|
1061
|
+
# define z_abbr_shrink_from_top_left z_abbr_type_shrink_from_top_left (REAL)
|
1062
|
+
# define z_abbr_shrink_from_top_right z_abbr_type_shrink_from_top_right (REAL)
|
1063
|
+
# define z_abbr_shrink_in_x_from_center z_abbr_type_shrink_in_x_from_center (REAL)
|
1064
|
+
# define z_abbr_shrink_in_x_from_left z_abbr_type_shrink_in_x_from_left (REAL)
|
1065
|
+
# define z_abbr_shrink_in_x_from_right z_abbr_type_shrink_in_x_from_right (REAL)
|
1066
|
+
# define z_abbr_shrink_in_y_from_bottom z_abbr_type_shrink_in_y_from_bottom (REAL)
|
1067
|
+
# define z_abbr_shrink_in_y_from_center z_abbr_type_shrink_in_y_from_center (REAL)
|
1068
|
+
# define z_abbr_shrink_in_y_from_top z_abbr_type_shrink_in_y_from_top (REAL)
|
1069
|
+
# define z_aabr_swap z_2d_line_swap
|
1070
|
+
# define z_aabr_top_center z_aabr_type_top_center (REAL)
|
1071
|
+
# define z_aabr_top_half z_aabr_type_top_half (REAL)
|
1072
|
+
# define z_aabr_top_left z_aabr_type_top_left (REAL)
|
1073
|
+
# define z_aabr_top_left_quarter z_aabr_type_top_left_quarter (REAL)
|
1074
|
+
# define z_aabr_top_right z_aabr_type_top_right (REAL)
|
1075
|
+
# define z_aabr_top_right_quarter z_aabr_type_top_right_quarter (REAL)
|
1076
|
+
# define z_aabr_union z_aabr_type_union (REAL)
|
1077
|
+
# define z_aabr_unit_point_to_absolute z_aabr_type_unit_point_to_absolute (REAL)
|
1078
|
+
#endif
|
1079
|
+
|
1080
|
+
|
1081
|
+
#endif /* _Z_functions_mathematics_geometry_euclidean_ZAABR_H_ */
|