zemu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,112 @@
|
|
1
|
+
/* Z Kit - functions/base/value.hpp
|
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_base_value_HPP_
|
9
|
+
#define _Z_functions_base_value_HPP_
|
10
|
+
|
11
|
+
#include <Z/traits/Type.hpp>
|
12
|
+
|
13
|
+
namespace Zeta {
|
14
|
+
|
15
|
+
|
16
|
+
// MARK: - Functions for any type
|
17
|
+
|
18
|
+
|
19
|
+
template <class T> static Z_INLINE void swap(void *a, void *b)
|
20
|
+
{
|
21
|
+
T t = *(T *)a;
|
22
|
+
*(T *)a = *(T *)b;
|
23
|
+
*(T *)b = t;
|
24
|
+
}
|
25
|
+
|
26
|
+
|
27
|
+
// MARK: - Functions for comparable types
|
28
|
+
|
29
|
+
|
30
|
+
template <class T> static Z_CT(CPP11) T maximum(T a, T b) {return a > b ? a : b;}
|
31
|
+
template <class T> static Z_CT(CPP11) T minimum(T a, T b) {return a < b ? a : b;}
|
32
|
+
|
33
|
+
|
34
|
+
template <class T> static Z_CT(CPP11) T clamp(T value, T minimum, T maximum)
|
35
|
+
{return Zeta::minimum(Zeta::maximum(value, minimum), maximum);}
|
36
|
+
|
37
|
+
|
38
|
+
// MARK: - Functions for signed types
|
39
|
+
|
40
|
+
|
41
|
+
template <class T> static Z_CT(CPP11) T absolute(T value)
|
42
|
+
{return value < T(0) ? -value : value;}
|
43
|
+
|
44
|
+
|
45
|
+
template <class T> static Z_CT(CPP11) T sign(T value)
|
46
|
+
{return value >= T(0) ? T(1) : -T(1);}
|
47
|
+
|
48
|
+
|
49
|
+
// MARK: - Functions for real types
|
50
|
+
|
51
|
+
|
52
|
+
template <class T> static Z_CT(CPP11) Boolean are_almost_equal(T a, T b)
|
53
|
+
{return absolute(a - b) <= Type<T>::epsilon();}
|
54
|
+
|
55
|
+
|
56
|
+
template <class T> static Z_CT(CPP11) T clamp_01(T value)
|
57
|
+
{return minimum<T>(maximum<T>(value, T(0.0)), T(1.0));}
|
58
|
+
|
59
|
+
|
60
|
+
template <class T> static Z_CT(CPP11) T inverse_lerp(T a, T b, T t)
|
61
|
+
{return (t - a) / (b - a);}
|
62
|
+
|
63
|
+
|
64
|
+
template <class T> static Z_CT(CPP11) Boolean is_almost_zero(T value)
|
65
|
+
{return absolute<T>(value) <= Type<T>::epsilon();}
|
66
|
+
|
67
|
+
|
68
|
+
template <class T> static Z_CT(CPP11) Boolean is_finite(T value)
|
69
|
+
{return value == value && value != Type<T>::infinity() && value != -Type<T>::infinity();}
|
70
|
+
|
71
|
+
|
72
|
+
template <class T> static Z_CT(CPP11) Boolean is_infinity(T value)
|
73
|
+
{return value == Type<T>::infinity() || value == -Type<T>::infinity();}
|
74
|
+
|
75
|
+
|
76
|
+
template <class T> static Z_CT(CPP11) Boolean is_nan(T value)
|
77
|
+
{return !(value == value);}
|
78
|
+
|
79
|
+
|
80
|
+
template <class T> static Z_CT(CPP11) T lerp(T a, T b, T t)
|
81
|
+
{return a + t * (b - a);}
|
82
|
+
|
83
|
+
|
84
|
+
template <class T> static Z_CT(CPP11) T sign_or_zero(T value)
|
85
|
+
{
|
86
|
+
return absolute<T>(value) <= Type<T>::epsilon()
|
87
|
+
? T(0.0)
|
88
|
+
: sign<T>(value);
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
template <class T> static Z_CT(CPP14) T smootherstep(T a, T b, T t)
|
93
|
+
{
|
94
|
+
if (t <= a) return T(0.0);
|
95
|
+
if (t >= b) return T(1.0);
|
96
|
+
t = (t - a) / (b - a);
|
97
|
+
return t * t * t * (t * (t * T(6.0) - T(15.0)) + T(10.0));
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
template <class T> static Z_CT(CPP14) T smoothstep(T a, T b, T t)
|
102
|
+
{
|
103
|
+
if (t <= a) return T(0.0);
|
104
|
+
if (t >= b) return T(1.0);
|
105
|
+
t = (t - a) / (b - a);
|
106
|
+
return t * t * (T(3.0) - T(2.0) * t);
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
}
|
111
|
+
|
112
|
+
#endif // _Z_functions_base_value_HPP_
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/* Z Kit - functioms/buffering/ZRingBuffer.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_buffering_ZRingBuffer_H_
|
9
|
+
#define _Z_functions_buffering_ZRingBuffer_H_
|
10
|
+
|
11
|
+
#include <Z/types/buffering.h>
|
12
|
+
#include <Z/functions/base/value.h>
|
13
|
+
|
14
|
+
#define z_cpu_relax() asm volatile("pause\n": : :"memory")
|
15
|
+
|
16
|
+
|
17
|
+
static Z_INLINE void z_ring_buffer_initialize(
|
18
|
+
ZRingBuffer* object,
|
19
|
+
void const* buffers,
|
20
|
+
zusize buffer_size,
|
21
|
+
zusize buffer_count
|
22
|
+
)
|
23
|
+
{
|
24
|
+
object->buffers = (void *)buffers;
|
25
|
+
object->buffer_size = buffer_size;
|
26
|
+
object->buffer_count = buffer_count;
|
27
|
+
object->production_index = 0;
|
28
|
+
object->consumption_index = 0;
|
29
|
+
object->fill_count = 0;
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
static Z_INLINE void *z_ring_buffer_production_buffer(ZRingBuffer const *object)
|
34
|
+
{
|
35
|
+
return object->buffer_count - object->fill_count
|
36
|
+
? (zuint8 *)object->buffers + object->production_index * object->buffer_size
|
37
|
+
: NULL;
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
static Z_INLINE void *z_ring_buffer_consumption_buffer(ZRingBuffer const *object)
|
42
|
+
{
|
43
|
+
return object->fill_count
|
44
|
+
? (zuint8 *)object->buffers + object->consumption_index * object->buffer_size
|
45
|
+
: NULL;
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
static Z_INLINE void *z_ring_buffer_try_produce(ZRingBuffer *object)
|
50
|
+
{
|
51
|
+
if (object->buffer_count == object->fill_count) return NULL;
|
52
|
+
object->production_index = (object->production_index + 1) % object->buffer_count;
|
53
|
+
z_type_atomic_increment_then_get(USIZE)(&object->fill_count);
|
54
|
+
return (zuint8 *)object->buffers + object->production_index * object->buffer_size;
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
static Z_INLINE void *z_ring_buffer_try_consume(ZRingBuffer *object)
|
59
|
+
{
|
60
|
+
if (!object->fill_count) return NULL;
|
61
|
+
object->consumption_index = (object->consumption_index + 1) % object->buffer_count;
|
62
|
+
z_type_atomic_decrement_then_get(USIZE)(&object->fill_count);
|
63
|
+
return (zuint8 *)object->buffers + object->consumption_index * object->buffer_size;
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
static Z_INLINE void *z_ring_buffer_produce(ZRingBuffer *object)
|
68
|
+
{
|
69
|
+
while (object->buffer_count == object->fill_count) z_cpu_relax();
|
70
|
+
object->production_index = (object->production_index + 1) % object->buffer_count;
|
71
|
+
z_type_atomic_increment_then_get(USIZE)(&object->fill_count);
|
72
|
+
return (zuint8 *)object->buffers + object->production_index * object->buffer_size;
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
static Z_INLINE void *z_ring_buffer_consume(ZRingBuffer *object)
|
77
|
+
{
|
78
|
+
while (!object->fill_count) z_cpu_relax();
|
79
|
+
object->consumption_index = (object->consumption_index + 1) % object->buffer_count;
|
80
|
+
z_type_atomic_decrement_then_get(USIZE)(&object->fill_count);
|
81
|
+
return (zuint8 *)object->buffers + object->consumption_index * object->buffer_size;
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
#endif /* _Z_functions_buffering_ZRingBuffer_H_ */
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* Z Kit - functioms/buffering/ZTripleBuffer.h
|
2
|
+
_____ _______________
|
3
|
+
/_ /_/ -_/_ _/ _ |
|
4
|
+
/____/\___/ /__//___/_| Kit
|
5
|
+
Copyright (C) 2012 Remis.
|
6
|
+
Copyright (C) 2014 Manuel Sainz de Baranda y Goñi.
|
7
|
+
Released under the terms of the GNU Lesser General Public License v3. */
|
8
|
+
|
9
|
+
#ifndef _Z_functions_buffering_ZTripleBuffer_H_
|
10
|
+
#define _Z_functions_buffering_ZTripleBuffer_H_
|
11
|
+
|
12
|
+
#include <Z/types/buffering.h>
|
13
|
+
#include <Z/functions/base/value.h>
|
14
|
+
|
15
|
+
|
16
|
+
static Z_INLINE void z_triple_buffer_initialize(
|
17
|
+
ZTripleBuffer* object,
|
18
|
+
void const* buffers,
|
19
|
+
zusize buffer_size
|
20
|
+
)
|
21
|
+
{
|
22
|
+
object->buffers[0] = (zuint8 *)buffers;
|
23
|
+
object->buffers[1] = (zuint8 *)buffers + buffer_size;
|
24
|
+
object->buffers[2] = (zuint8 *)buffers + buffer_size * 2;
|
25
|
+
object->flags = 6;
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
static Z_INLINE void *z_triple_buffer_production_buffer(ZTripleBuffer const *object)
|
30
|
+
{return object->buffers[(object->flags & 48) >> 4];}
|
31
|
+
|
32
|
+
|
33
|
+
static Z_INLINE void *z_triple_buffer_consumption_buffer(ZTripleBuffer const *object)
|
34
|
+
{return object->buffers[object->flags & 3];}
|
35
|
+
|
36
|
+
|
37
|
+
static Z_INLINE void *z_triple_buffer_produce(ZTripleBuffer *object)
|
38
|
+
{
|
39
|
+
zuint8 flags, new_flags;
|
40
|
+
|
41
|
+
do {
|
42
|
+
flags = object->flags;
|
43
|
+
new_flags = 64 | ((flags & 12) << 2) | ((flags & 48) >> 2) | (flags & 3);
|
44
|
+
}
|
45
|
+
while (!z_uint8_atomic_set_if_equal(&object->flags, flags, new_flags));
|
46
|
+
|
47
|
+
return object->buffers[(new_flags & 48) >> 4];
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
static Z_INLINE void *z_triple_buffer_consume(ZTripleBuffer *object)
|
52
|
+
{
|
53
|
+
zuint8 flags, new_flags;
|
54
|
+
|
55
|
+
do {
|
56
|
+
if (!((flags = object->flags) & 64)) return NULL;
|
57
|
+
new_flags = (flags & 48) | ((flags & 3) << 2) | ((flags & 12) >> 2);
|
58
|
+
}
|
59
|
+
while (!z_uint8_atomic_set_if_equal(&object->flags, flags, new_flags));
|
60
|
+
|
61
|
+
return object->buffers[new_flags & 3];;
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
#endif /* _Z_functions_buffering_ZTripleBuffer_H_ */
|
@@ -0,0 +1,179 @@
|
|
1
|
+
/* Z Kit - functions/mathematics/geometry/euclidean/Z2DLine.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_Z2DLine_H_
|
9
|
+
#define _Z_functions_mathematics_geometry_euclidean_Z2DLine_H_
|
10
|
+
|
11
|
+
#include <Z/functions/mathematics/geometry/euclidean/constructors.h>
|
12
|
+
#include <Z/functions/base/Z2D.h>
|
13
|
+
|
14
|
+
|
15
|
+
/* MARK: - Common implementation */
|
16
|
+
|
17
|
+
|
18
|
+
#define Z_IMPLEMENTATION_COMMON(Type, type) \
|
19
|
+
\
|
20
|
+
static Z_INLINE \
|
21
|
+
zboolean z_2d_line_##type##_are_equal(Z2DLine##Type a, Z2DLine##Type b) \
|
22
|
+
{return z_2d_##type##_are_equal(a.a, b.a) && z_2d_##type##_are_equal(a.b, b.b);} \
|
23
|
+
\
|
24
|
+
\
|
25
|
+
static Z_INLINE \
|
26
|
+
zboolean z_2d_line_##type##_are_perpendicular(Z2DLine##Type a, Z2DLine##Type b) \
|
27
|
+
{ \
|
28
|
+
return z_2d_##type##_are_perpendicular \
|
29
|
+
(z_2d_##type##_subtract(a.b, a.a), z_2d_##type##_subtract(b.b, b.a)); \
|
30
|
+
} \
|
31
|
+
\
|
32
|
+
\
|
33
|
+
static Z_INLINE \
|
34
|
+
zboolean z_2d_line_##type##_is_zero(Z2DLine##Type object) \
|
35
|
+
{return z_2d_##type##_is_zero(object.a) && z_2d_##type##_is_zero(object.b);} \
|
36
|
+
\
|
37
|
+
\
|
38
|
+
static Z_INLINE \
|
39
|
+
Z2DLine##Type z_2d_line_##type##_reverse(Z2DLine##Type object) \
|
40
|
+
{return z_2d_line_##type(object.b.x, object.b.y, object.a.x, object.a.y);} \
|
41
|
+
\
|
42
|
+
\
|
43
|
+
static Z_INLINE \
|
44
|
+
void z_2d_line_##type##_swap(Z2DLine##Type *a, Z2DLine##Type *b) \
|
45
|
+
{ \
|
46
|
+
Z2DLine##Type t = *a; \
|
47
|
+
\
|
48
|
+
*a = *b; *b = t; \
|
49
|
+
} \
|
50
|
+
\
|
51
|
+
\
|
52
|
+
static Z_INLINE \
|
53
|
+
ZAABR##Type z_2d_line_segment_##type##_aabr(Z2DLine##Type object) \
|
54
|
+
{ \
|
55
|
+
return z_aabr_##type \
|
56
|
+
(z_##type##_minimum(object.a.x, object.b.x), \
|
57
|
+
z_##type##_minimum(object.a.y, object.b.y), \
|
58
|
+
z_##type##_maximum(object.a.x, object.b.x), \
|
59
|
+
z_##type##_maximum(object.a.y, object.b.y)); \
|
60
|
+
} \
|
61
|
+
\
|
62
|
+
\
|
63
|
+
static Z_INLINE \
|
64
|
+
Z2D##Type z_2d_line_segment_##type##_center(Z2DLine##Type object) \
|
65
|
+
{return z_2d_##type##_middle(object.a, object.b);}
|
66
|
+
|
67
|
+
|
68
|
+
#define z_2d_line_type_are_equal( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_, _are_equal )
|
69
|
+
#define z_2d_line_type_are_perpendicular(TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_, _are_perpendicular)
|
70
|
+
#define z_2d_line_type_is_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_, _is_zero )
|
71
|
+
#define z_2d_line_type_reverse( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_, _reverse )
|
72
|
+
#define z_2d_line_type_swap( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_, _swap )
|
73
|
+
#define z_2d_line_segment_aabr( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_segment_, _aabr )
|
74
|
+
#define z_2d_line_segment_type_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_segment_, _center )
|
75
|
+
|
76
|
+
|
77
|
+
/* MARK: - Partial implementation for real types */
|
78
|
+
|
79
|
+
|
80
|
+
#define Z_IMPLEMENTATION_REAL(Type, type) \
|
81
|
+
\
|
82
|
+
static Z_INLINE \
|
83
|
+
zboolean z_2d_line_segment_##type##_intersect(Z2DLine##Type a, Z2DLine##Type b) \
|
84
|
+
{ \
|
85
|
+
Z2D##Type d = z_2d_##type##_subtract(b.a, a.a); \
|
86
|
+
Z2D##Type va = z_2d_##type##_subtract(a.b, a.a); \
|
87
|
+
Z2D##Type vb = z_2d_##type##_subtract(b.b, b.a); \
|
88
|
+
z##type c = z_2d_##type##_cross_product(va, vb); \
|
89
|
+
z##type t = z_2d_##type##_cross_product(d, vb) / c; \
|
90
|
+
z##type u = z_2d_##type##_cross_product(d, va) / c; \
|
91
|
+
\
|
92
|
+
return !(t < (z##type)0 || t > (z##type)1 || u < (z##type)0 || u > (z##type)1); \
|
93
|
+
} \
|
94
|
+
\
|
95
|
+
\
|
96
|
+
static Z_INLINE \
|
97
|
+
Z2D##Type z_2d_line_segment_##type##_lerp(Z2DLine##Type object, z##type alpha) \
|
98
|
+
{return z_2d_##type##_lerp(object.a, object.b, alpha);}
|
99
|
+
|
100
|
+
|
101
|
+
#define z_2d_line_segment_type_intersect(TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_segment_, _intersect)
|
102
|
+
#define z_2d_line_segment_type_lerp( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_segment_, _lerp )
|
103
|
+
|
104
|
+
|
105
|
+
/* MARK: - Implementation expansions */
|
106
|
+
|
107
|
+
|
108
|
+
Z_IMPLEMENTATION_COMMON(SInt8, sint8 )
|
109
|
+
Z_IMPLEMENTATION_COMMON(SInt16, sint16)
|
110
|
+
Z_IMPLEMENTATION_COMMON(SInt32, sint32)
|
111
|
+
|
112
|
+
#ifdef Z_SINT64
|
113
|
+
Z_IMPLEMENTATION_COMMON(SInt64, sint64)
|
114
|
+
#endif
|
115
|
+
|
116
|
+
#ifdef Z_SINT128
|
117
|
+
Z_IMPLEMENTATION_COMMON(SInt128, sint128)
|
118
|
+
#endif
|
119
|
+
|
120
|
+
#ifdef Z_FLOAT16
|
121
|
+
Z_IMPLEMENTATION_COMMON(Float16, float16)
|
122
|
+
Z_IMPLEMENTATION_REAL (Float16, float16)
|
123
|
+
#endif
|
124
|
+
|
125
|
+
#ifdef Z_FLOAT32
|
126
|
+
Z_IMPLEMENTATION_COMMON(Float32, float32)
|
127
|
+
Z_IMPLEMENTATION_REAL (Float32, float32)
|
128
|
+
#endif
|
129
|
+
|
130
|
+
#ifdef Z_FLOAT64
|
131
|
+
Z_IMPLEMENTATION_COMMON(Float64, float64)
|
132
|
+
Z_IMPLEMENTATION_REAL (Float64, float64)
|
133
|
+
#endif
|
134
|
+
|
135
|
+
#ifdef Z_FLOAT128
|
136
|
+
Z_IMPLEMENTATION_COMMON(Float128, float128)
|
137
|
+
Z_IMPLEMENTATION_REAL (Float128, float128)
|
138
|
+
#endif
|
139
|
+
|
140
|
+
#ifdef Z_FLOAT80_X87
|
141
|
+
Z_IMPLEMENTATION_COMMON(Float80_x87, float80_x87)
|
142
|
+
Z_IMPLEMENTATION_REAL (Float80_x87, float80_x87)
|
143
|
+
#endif
|
144
|
+
|
145
|
+
#ifdef Z_FLOAT96_X87
|
146
|
+
Z_IMPLEMENTATION_COMMON(Float96_x87, float96_x87)
|
147
|
+
Z_IMPLEMENTATION_REAL (Float96_x87, float96_x87)
|
148
|
+
#endif
|
149
|
+
|
150
|
+
#ifdef Z_FLOAT128_X87
|
151
|
+
Z_IMPLEMENTATION_COMMON(Float128_x87, float128_x87)
|
152
|
+
Z_IMPLEMENTATION_REAL (Float128_x87, float128_x87)
|
153
|
+
#endif
|
154
|
+
|
155
|
+
|
156
|
+
/* MARK: - Cleanup */
|
157
|
+
|
158
|
+
|
159
|
+
#undef Z_IMPLEMENTATION_COMMON
|
160
|
+
#undef Z_IMPLEMENTATION_REAL
|
161
|
+
|
162
|
+
|
163
|
+
/* MARK: - Default real type definitions */
|
164
|
+
|
165
|
+
|
166
|
+
#ifdef Z_REAL
|
167
|
+
# define z_2d_line_are_equal z_2d_line_type_are_equal (REAL)
|
168
|
+
# define z_2d_line_are_perpendicular z_2d_line_type_are_perpendicular(REAL)
|
169
|
+
# define z_2d_line_is_zero z_2d_line_type_is_zero (REAL)
|
170
|
+
# define z_2d_line_reverse z_2d_line_type_reverse (REAL)
|
171
|
+
# define z_2d_line_swap z_2d_line_type_swap (REAL)
|
172
|
+
# define z_2d_line_segment_aabr z_2d_line_segment_type_aabr (REAL)
|
173
|
+
# define z_2d_line_segment_center z_2d_line_segment_type_center (REAL)
|
174
|
+
# define z_2d_line_segment_intersect z_2d_line_segment_type_intersect(REAL)
|
175
|
+
# define z_2d_line_segment_lerp z_2d_line_segment_type_lerp (REAL)
|
176
|
+
#endif
|
177
|
+
|
178
|
+
|
179
|
+
#endif /* _Z_functions_mathematics_geometry_euclidean_Z2DLine_H_ */
|
@@ -0,0 +1,168 @@
|
|
1
|
+
/* Z Kit - functions/mathematics/geometry/euclidean/Z3DLine.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_Z3DLine_H_
|
9
|
+
#define _Z_functions_mathematics_geometry_euclidean_Z3DLine_H_
|
10
|
+
|
11
|
+
#include <Z/functions/mathematics/geometry/euclidean/constructors.h>
|
12
|
+
#include <Z/functions/base/Z3D.h>
|
13
|
+
|
14
|
+
|
15
|
+
/* MARK: - Common implementation */
|
16
|
+
|
17
|
+
|
18
|
+
#define Z_IMPLEMENTATION_COMMON(Type, type) \
|
19
|
+
\
|
20
|
+
static Z_INLINE \
|
21
|
+
zboolean z_3d_line_##type##_are_equal(Z3DLine##Type a, Z3DLine##Type b) \
|
22
|
+
{return z_3d_##type##_are_equal(a.a, b.a) && z_3d_##type##_are_equal(a.b, b.b);} \
|
23
|
+
\
|
24
|
+
\
|
25
|
+
static Z_INLINE \
|
26
|
+
zboolean z_3d_line_##type##_are_perpendicular(Z3DLine##Type a, Z3DLine##Type b) \
|
27
|
+
{ \
|
28
|
+
return z_3d_##type##_are_perpendicular \
|
29
|
+
(z_3d_##type##_subtract(a.b, a.a), z_3d_##type##_subtract(b.b, b.a)); \
|
30
|
+
} \
|
31
|
+
\
|
32
|
+
\
|
33
|
+
static Z_INLINE \
|
34
|
+
zboolean z_3d_line_##type##_is_zero(Z3DLine##Type object) \
|
35
|
+
{return z_3d_##type##_is_zero(object.a) && z_3d_##type##_is_zero(object.b);} \
|
36
|
+
\
|
37
|
+
\
|
38
|
+
static Z_INLINE \
|
39
|
+
Z3DLine##Type z_3d_line_##type##_reverse(Z3DLine##Type object) \
|
40
|
+
{ \
|
41
|
+
return z_3d_line_##type \
|
42
|
+
(object.b.x, object.b.y, object.b.z, object.a.x, object.a.y, object.a.z); \
|
43
|
+
} \
|
44
|
+
\
|
45
|
+
\
|
46
|
+
static Z_INLINE \
|
47
|
+
void z_3d_line_##type##_swap(Z3DLine##Type *a, Z3DLine##Type *b) \
|
48
|
+
{ \
|
49
|
+
Z3DLine##Type t = *a; \
|
50
|
+
\
|
51
|
+
*a = *b; *b = t; \
|
52
|
+
} \
|
53
|
+
\
|
54
|
+
\
|
55
|
+
static Z_INLINE \
|
56
|
+
ZAABB##Type z_3d_line_segment_##type##_aabb(Z3DLine##Type object) \
|
57
|
+
{ \
|
58
|
+
return z_aabb_##type \
|
59
|
+
(z_##type##_minimum(object.a.x, object.b.x), \
|
60
|
+
z_##type##_minimum(object.a.y, object.b.y), \
|
61
|
+
z_##type##_minimum(object.a.z, object.b.z), \
|
62
|
+
z_##type##_maximum(object.a.x, object.b.x), \
|
63
|
+
z_##type##_maximum(object.a.y, object.b.y), \
|
64
|
+
z_##type##_maximum(object.a.z, object.b.z)); \
|
65
|
+
} \
|
66
|
+
\
|
67
|
+
\
|
68
|
+
static Z_INLINE \
|
69
|
+
Z3D##Type z_3d_line_segment_##type##_center(Z3DLine##Type object) \
|
70
|
+
{return z_3d_##type##_middle(object.a, object.b);}
|
71
|
+
|
72
|
+
|
73
|
+
#define z_3d_line_type_are_equal( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_, _are_equal )
|
74
|
+
#define z_3d_line_type_are_perpendicular(TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_, _are_perpendicular)
|
75
|
+
#define z_3d_line_type_is_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_, _is_zero )
|
76
|
+
#define z_3d_line_type_reverse( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_, _reverse )
|
77
|
+
#define z_3d_line_type_swap( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_, _swap )
|
78
|
+
#define z_2d_line_segment_aabb( TYPE) Z_INSERT_##TYPE##_fixed_type(z_2d_line_segment_, _aabb )
|
79
|
+
#define z_3d_line_segment_type_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_segment_, _center )
|
80
|
+
|
81
|
+
|
82
|
+
/* MARK: - Partial implementation for real types */
|
83
|
+
|
84
|
+
|
85
|
+
#define Z_IMPLEMENTATION_REAL(Type, type) \
|
86
|
+
\
|
87
|
+
static Z_INLINE \
|
88
|
+
Z3D##Type z_3d_line_segment_##type##_lerp(Z3DLine##Type object, z##type alpha) \
|
89
|
+
{return z_3d_##type##_lerp(object.a, object.b, alpha);}
|
90
|
+
|
91
|
+
|
92
|
+
#define z_3d_line_segment_type_lerp(TYPE) Z_INSERT_##TYPE##_fixed_type(z_3d_line_segment_, _lerp)
|
93
|
+
|
94
|
+
|
95
|
+
/* MARK: - Implementation expansions */
|
96
|
+
|
97
|
+
|
98
|
+
Z_IMPLEMENTATION_COMMON(SInt8, sint8 )
|
99
|
+
Z_IMPLEMENTATION_COMMON(SInt16, sint16)
|
100
|
+
Z_IMPLEMENTATION_COMMON(SInt32, sint32)
|
101
|
+
|
102
|
+
#ifdef Z_SINT64
|
103
|
+
Z_IMPLEMENTATION_COMMON(SInt64, sint64)
|
104
|
+
#endif
|
105
|
+
|
106
|
+
#ifdef Z_SINT128
|
107
|
+
Z_IMPLEMENTATION_COMMON(SInt128, sint128)
|
108
|
+
#endif
|
109
|
+
|
110
|
+
#ifdef Z_FLOAT16
|
111
|
+
Z_IMPLEMENTATION_COMMON(Float16, float16)
|
112
|
+
Z_IMPLEMENTATION_REAL (Float16, float16)
|
113
|
+
#endif
|
114
|
+
|
115
|
+
#ifdef Z_FLOAT32
|
116
|
+
Z_IMPLEMENTATION_COMMON(Float32, float32)
|
117
|
+
Z_IMPLEMENTATION_REAL (Float32, float32)
|
118
|
+
#endif
|
119
|
+
|
120
|
+
#ifdef Z_FLOAT64
|
121
|
+
Z_IMPLEMENTATION_COMMON(Float64, float64)
|
122
|
+
Z_IMPLEMENTATION_REAL (Float64, float64)
|
123
|
+
#endif
|
124
|
+
|
125
|
+
#ifdef Z_FLOAT128
|
126
|
+
Z_IMPLEMENTATION_COMMON(Float128, float128)
|
127
|
+
Z_IMPLEMENTATION_REAL (Float128, float128)
|
128
|
+
#endif
|
129
|
+
|
130
|
+
#ifdef Z_FLOAT80_X87
|
131
|
+
Z_IMPLEMENTATION_COMMON(Float80_x87, float80_x87)
|
132
|
+
Z_IMPLEMENTATION_REAL (Float80_x87, float80_x87)
|
133
|
+
#endif
|
134
|
+
|
135
|
+
#ifdef Z_FLOAT96_X87
|
136
|
+
Z_IMPLEMENTATION_COMMON(Float96_x87, float96_x87)
|
137
|
+
Z_IMPLEMENTATION_REAL (Float96_x87, float96_x87)
|
138
|
+
#endif
|
139
|
+
|
140
|
+
#ifdef Z_FLOAT128_X87
|
141
|
+
Z_IMPLEMENTATION_COMMON(Float128_x87, float128_x87)
|
142
|
+
Z_IMPLEMENTATION_REAL (Float128_x87, float128_x87)
|
143
|
+
#endif
|
144
|
+
|
145
|
+
|
146
|
+
/* MARK: - Cleanup */
|
147
|
+
|
148
|
+
|
149
|
+
#undef Z_IMPLEMENTATION_COMMON
|
150
|
+
#undef Z_IMPLEMENTATION_REAL
|
151
|
+
|
152
|
+
|
153
|
+
/* MARK: - Default real type definitions */
|
154
|
+
|
155
|
+
|
156
|
+
#ifdef Z_REAL
|
157
|
+
# define z_3d_line_are_equal z_3d_line_type_are_equal (REAL)
|
158
|
+
# define z_3d_line_are_perpendicular z_3d_line_type_are_perpendicular(REAL)
|
159
|
+
# define z_3d_line_is_zero z_3d_line_type_is_zero (REAL)
|
160
|
+
# define z_3d_line_reverse z_3d_line_type_reverse (REAL)
|
161
|
+
# define z_3d_line_swap z_3d_line_type_swap (REAL)
|
162
|
+
# define z_2d_line_segment_aabb z_2d_line_segment_type_aabb (REAL)
|
163
|
+
# define z_3d_line_segment_center z_3d_line_segment_type_center (REAL)
|
164
|
+
# define z_3d_line_segment_lerp z_3d_line_segment_type_lerp (REAL)
|
165
|
+
#endif
|
166
|
+
|
167
|
+
|
168
|
+
#endif /* _Z_functions_mathematics_geometry_euclidean_Z3DLine_H_ */
|