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,675 @@
|
|
1
|
+
/* Z Kit - classes/mathematics/geometry/euclidean/Rectangle.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_classes_mathematics_geometry_euclidean_Rectangle_HPP_
|
9
|
+
#define _Z_classes_mathematics_geometry_euclidean_Rectangle_HPP_
|
10
|
+
|
11
|
+
#include <Z/classes/base/Value2D.hpp>
|
12
|
+
#include <Z/types/mathematics.h>
|
13
|
+
|
14
|
+
|
15
|
+
#define Z_IMPLEMENTATION_FOUNDATION_CONSTRUCTOR(Prefix) \
|
16
|
+
Z_CT(CPP11) Rectangle(const Prefix##Rect &rectangle) \
|
17
|
+
: point(rectangle.origin), size(rectangle.size) {}
|
18
|
+
|
19
|
+
|
20
|
+
#if Z_LANGUAGE_HAS(CPP, INITIALIZER_LIST)
|
21
|
+
|
22
|
+
# define Z_IMPLEMENTATION_FOUNDATION_OPERATOR(Prefix) \
|
23
|
+
\
|
24
|
+
Z_CT(CPP11) operator Prefix##Rect() const \
|
25
|
+
{ \
|
26
|
+
return {{CGFloat(point.x), CGFloat(point.y)}, \
|
27
|
+
{CGFloat(size.x), CGFloat(size.y)}}; \
|
28
|
+
}
|
29
|
+
|
30
|
+
#else
|
31
|
+
|
32
|
+
# define Z_IMPLEMENTATION_FOUNDATION_OPERATOR(Prefix) \
|
33
|
+
\
|
34
|
+
Z_CT(CPP14) operator Prefix##Rect() const \
|
35
|
+
{ \
|
36
|
+
CGRect result = { \
|
37
|
+
{CGFloat(point.x), CGFloat(point.y)}, \
|
38
|
+
{CGFloat(size.x), CGFloat(size.y)} \
|
39
|
+
}; \
|
40
|
+
\
|
41
|
+
return result; \
|
42
|
+
}
|
43
|
+
|
44
|
+
#endif
|
45
|
+
|
46
|
+
|
47
|
+
#ifdef Z_USE_CG_GEOMETRY
|
48
|
+
|
49
|
+
# include <CoreGraphics/CGGeometry.h>
|
50
|
+
|
51
|
+
# define Z_IMPLEMENTATION_CG_GEOMETRY \
|
52
|
+
Z_IMPLEMENTATION_FOUNDATION_CONSTRUCTOR(CG) \
|
53
|
+
Z_IMPLEMENTATION_FOUNDATION_OPERATOR (CG)
|
54
|
+
|
55
|
+
#else
|
56
|
+
# define Z_IMPLEMENTATION_CG_GEOMETRY
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#if defined(Z_USE_NS_GEOMETRY) && Z_LANGUAGE_INCLUDES(OBJECTIVE_CPP)
|
60
|
+
|
61
|
+
# import <Foundation/NSGeometry.h>
|
62
|
+
|
63
|
+
# if !defined(Z_USE_CG_GEOMETRY) || \
|
64
|
+
!defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) || \
|
65
|
+
!NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
|
66
|
+
|
67
|
+
# define Z_IMPLEMENTATION_NS_GEOMETRY \
|
68
|
+
Z_IMPLEMENTATION_FOUNDATION_CONSTRUCTOR(NS) \
|
69
|
+
Z_IMPLEMENTATION_FOUNDATION_OPERATOR (NS)
|
70
|
+
|
71
|
+
# endif
|
72
|
+
|
73
|
+
#endif
|
74
|
+
|
75
|
+
#ifndef Z_IMPLEMENTATION_NS_GEOMETRY
|
76
|
+
# define Z_IMPLEMENTATION_NS_GEOMETRY
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#ifdef Z_USE_COCOS2D_X
|
80
|
+
|
81
|
+
# include "cocos2d.h"
|
82
|
+
|
83
|
+
# define Z_IMPLEMENTATION_COCOS2D_X \
|
84
|
+
\
|
85
|
+
Z_INLINE Rectangle(const cocos2d::Rect &rectangle) \
|
86
|
+
: point(rectangle.origin), size(rectangle.size) {} \
|
87
|
+
\
|
88
|
+
\
|
89
|
+
Z_INLINE operator cocos2d::Rect() const \
|
90
|
+
{ \
|
91
|
+
return cocos2d::Rect \
|
92
|
+
(float(point.x), float(point.y), \
|
93
|
+
float(size.x), float(size.y)); \
|
94
|
+
}
|
95
|
+
|
96
|
+
#else
|
97
|
+
# define Z_IMPLEMENTATION_COCOS2D_X
|
98
|
+
#endif
|
99
|
+
|
100
|
+
|
101
|
+
#define Z_IMPLEMENTATION_COMMON \
|
102
|
+
\
|
103
|
+
typedef typename ZTypeFixedSigned(ZRectangle, T) Base; \
|
104
|
+
Value2D<T> point, size; \
|
105
|
+
\
|
106
|
+
Z_INLINE Rectangle() Z_DEFAULTED({}) \
|
107
|
+
\
|
108
|
+
\
|
109
|
+
Z_CT(CPP11) Rectangle(const Value2D<T> &point, const Value2D<T> &size) \
|
110
|
+
: point(point), size(size) {} \
|
111
|
+
\
|
112
|
+
\
|
113
|
+
Z_CT(CPP11) Rectangle(const Value2D<T> &point, T size_x, T size_y) \
|
114
|
+
: point(point), size(size_x, size_y) {} \
|
115
|
+
\
|
116
|
+
\
|
117
|
+
Z_CT(CPP11) Rectangle(const Value2D<T> &point, T size_xy) \
|
118
|
+
: point(point), size(size_xy) {} \
|
119
|
+
\
|
120
|
+
\
|
121
|
+
Z_CT(CPP11) Rectangle(T point_x, T point_y, const Value2D<T> &size) \
|
122
|
+
: point(point_x, point_y), size(size) {} \
|
123
|
+
\
|
124
|
+
\
|
125
|
+
Z_CT(CPP11) Rectangle(T point_x, T point_y, T size_x, T size_y) \
|
126
|
+
: point(point_x, point_y), size(size_x, size_y) {} \
|
127
|
+
\
|
128
|
+
\
|
129
|
+
Z_CT(CPP11) Rectangle(T point_x, T point_y, T size_xy) \
|
130
|
+
: point(point_x, point_y), size(size_xy) {} \
|
131
|
+
\
|
132
|
+
\
|
133
|
+
Z_CT(CPP11) Rectangle(T point_xy, const Value2D<T> &size) \
|
134
|
+
: point(point_xy), size(size) {} \
|
135
|
+
\
|
136
|
+
\
|
137
|
+
Z_CT(CPP11) Rectangle(const Value2D<T> &size) \
|
138
|
+
: point(T(0)), size(size) {} \
|
139
|
+
\
|
140
|
+
\
|
141
|
+
Z_CT(CPP11) Rectangle(T size_x, T size_y) \
|
142
|
+
: point(T(0)), size(size_x, size_y) {} \
|
143
|
+
\
|
144
|
+
\
|
145
|
+
Z_CT(CPP11) Rectangle(T size_xy) \
|
146
|
+
: point(T(0)), size(size_xy) {} \
|
147
|
+
\
|
148
|
+
\
|
149
|
+
Z_CT(CPP11) Rectangle(const Base &rectangle) \
|
150
|
+
: point(rectangle.point), size(rectangle.size) {} \
|
151
|
+
\
|
152
|
+
\
|
153
|
+
static Z_CT(CPP14) Rectangle from_vertices(const Value2D<T> &a, const Value2D<T> &b) \
|
154
|
+
{ \
|
155
|
+
Value2D<T> minimum = a.minimum(b); \
|
156
|
+
\
|
157
|
+
return Rectangle(minimum, a.maximum(b) - minimum); \
|
158
|
+
} \
|
159
|
+
\
|
160
|
+
\
|
161
|
+
Z_CT(CPP11) operator Boolean() const {return point || size;} \
|
162
|
+
Z_INLINE operator Base& () const {return *((Base *)this);} \
|
163
|
+
\
|
164
|
+
\
|
165
|
+
Z_CT(CPP11) Boolean operator ==(const Rectangle &rhs) const \
|
166
|
+
{return point == rhs.point && size == rhs.size;} \
|
167
|
+
\
|
168
|
+
\
|
169
|
+
Z_CT(CPP11) Boolean operator !=(const Rectangle &rhs) const \
|
170
|
+
{return point != rhs.point || size != rhs.size;} \
|
171
|
+
\
|
172
|
+
\
|
173
|
+
/* Intersection */ \
|
174
|
+
Z_CT(CPP14) Rectangle operator &(const Rectangle &rhs) const \
|
175
|
+
{ \
|
176
|
+
T x1, x2, y1, y2; \
|
177
|
+
\
|
178
|
+
return (x1 = maximum<T>(point.x, rhs.point.x)) < \
|
179
|
+
(x2 = minimum<T>(point.x + size.x, rhs.point.x + rhs.size.x)) && \
|
180
|
+
(y1 = maximum<T>(point.y, rhs.point.y)) < \
|
181
|
+
(y2 = minimum<T>(point.y + size.y, rhs.point.y + rhs.size.y)) \
|
182
|
+
\
|
183
|
+
? Rectangle(x1, y1, x2 - x1, y2 - y1) \
|
184
|
+
: Rectangle(T(0)); \
|
185
|
+
} \
|
186
|
+
\
|
187
|
+
\
|
188
|
+
/* Union */ \
|
189
|
+
Z_CT(CPP14) Rectangle operator |(const Rectangle &rhs) const \
|
190
|
+
{ \
|
191
|
+
Rectangle result; \
|
192
|
+
\
|
193
|
+
result.point = point.minimum(rhs.point); \
|
194
|
+
result.size = (point + size).maximum(rhs.point + rhs.size) - result.point; \
|
195
|
+
return result; \
|
196
|
+
} \
|
197
|
+
\
|
198
|
+
\
|
199
|
+
Z_INLINE Rectangle &operator &=(const Rectangle &rhs) {return *this = *this & rhs;} \
|
200
|
+
Z_INLINE Rectangle &operator |=(const Rectangle &rhs) {return *this = *this | rhs;} \
|
201
|
+
\
|
202
|
+
Z_CT(CPP11) Rectangle operator +(const Value2D<T> &rhs) const {return Rectangle(point + rhs, size);} \
|
203
|
+
Z_CT(CPP11) Rectangle operator -(const Value2D<T> &rhs) const {return Rectangle(point - rhs, size);} \
|
204
|
+
Z_CT(CPP11) Rectangle operator *(const Value2D<T> &rhs) const {return Rectangle(point * rhs, size);} \
|
205
|
+
Z_CT(CPP11) Rectangle operator /(const Value2D<T> &rhs) const {return Rectangle(point / rhs, size);} \
|
206
|
+
\
|
207
|
+
Z_INLINE Rectangle &operator +=(const Value2D<T> &rhs) {return *this = *this + rhs;} \
|
208
|
+
Z_INLINE Rectangle &operator -=(const Value2D<T> &rhs) {return *this = *this - rhs;} \
|
209
|
+
Z_INLINE Rectangle &operator *=(const Value2D<T> &rhs) {return *this = *this * rhs;} \
|
210
|
+
Z_INLINE Rectangle &operator /=(const Value2D<T> &rhs) {return *this = *this / rhs;} \
|
211
|
+
\
|
212
|
+
Z_CT(CPP11) Rectangle operator +(T rhs) const {return Value2D<T>(point + rhs, size);} \
|
213
|
+
Z_CT(CPP11) Rectangle operator -(T rhs) const {return Value2D<T>(point - rhs, size);} \
|
214
|
+
Z_CT(CPP11) Rectangle operator *(T rhs) const {return Value2D<T>(point * rhs, size);} \
|
215
|
+
Z_CT(CPP11) Rectangle operator /(T rhs) const {return Value2D<T>(point / rhs, size);} \
|
216
|
+
\
|
217
|
+
Z_INLINE Rectangle &operator +=(T rhs) {return *this = *this + rhs;} \
|
218
|
+
Z_INLINE Rectangle &operator -=(T rhs) {return *this = *this - rhs;} \
|
219
|
+
Z_INLINE Rectangle &operator *=(T rhs) {return *this = *this * rhs;} \
|
220
|
+
Z_INLINE Rectangle &operator /=(T rhs) {return *this = *this / rhs;} \
|
221
|
+
\
|
222
|
+
Z_IMPLEMENTATION_CG_GEOMETRY \
|
223
|
+
Z_IMPLEMENTATION_NS_GEOMETRY \
|
224
|
+
Z_IMPLEMENTATION_COCOS2D_X \
|
225
|
+
\
|
226
|
+
\
|
227
|
+
Z_CT(CPP11) Rectangle align_in_bottom_center(const Value2D<T> &size) const \
|
228
|
+
{return Rectangle(this->point.x + (this->size.x - size.x) / T(2), this->point.y, size);}\
|
229
|
+
\
|
230
|
+
\
|
231
|
+
Z_CT(CPP11) Rectangle align_in_bottom_left(const Value2D<T> &size) const \
|
232
|
+
{return Rectangle(this->point, size);} \
|
233
|
+
\
|
234
|
+
\
|
235
|
+
Z_CT(CPP11) Rectangle align_in_bottom_right(const Value2D<T> &size) const \
|
236
|
+
{return Rectangle(this->point.x + this->size.x - size.x, this->point.y, size);} \
|
237
|
+
\
|
238
|
+
\
|
239
|
+
Z_CT(CPP11) Rectangle align_in_center(const Value2D<T> &size) const \
|
240
|
+
{return Rectangle(this->point + (this->size - size) / T(2), size);} \
|
241
|
+
\
|
242
|
+
\
|
243
|
+
Z_CT(CPP11) Rectangle align_in_center_left(const Value2D<T> &size) const \
|
244
|
+
{return Rectangle(this->point.x, this->point.y + (this->size.y - size.y) / T(2), size);}\
|
245
|
+
\
|
246
|
+
\
|
247
|
+
Z_CT(CPP11) Rectangle align_in_center_right(const Value2D<T> &size) const \
|
248
|
+
{ \
|
249
|
+
return Rectangle \
|
250
|
+
(this->point.x + this->size.x - size.x, \
|
251
|
+
this->point.y + (this->size.y - size.y) / T(2), \
|
252
|
+
size); \
|
253
|
+
} \
|
254
|
+
\
|
255
|
+
\
|
256
|
+
Z_CT(CPP11) Rectangle align_in_top_center(const Value2D<T> &size) const \
|
257
|
+
{ \
|
258
|
+
return Rectangle \
|
259
|
+
(this->point.x + (this->size.x - size.x) / T(2), \
|
260
|
+
this->point.y + this->size.y - size.y, \
|
261
|
+
size); \
|
262
|
+
} \
|
263
|
+
\
|
264
|
+
\
|
265
|
+
Z_CT(CPP11) Rectangle align_in_top_left(const Value2D<T> &size) const \
|
266
|
+
{return Rectangle(this->point.x, this->point.y + this->size.y - size.y, size);} \
|
267
|
+
\
|
268
|
+
\
|
269
|
+
Z_CT(CPP11) Rectangle align_in_top_right(const Value2D<T> &size) const \
|
270
|
+
{return Rectangle(this->point + this->size - size, size);} \
|
271
|
+
\
|
272
|
+
\
|
273
|
+
Z_CT(CPP11) Value2D<T> bottom_center() const \
|
274
|
+
{return Value2D<T>(point.x + size.x / T(2), point.y);} \
|
275
|
+
\
|
276
|
+
\
|
277
|
+
Z_CT(CPP11) Rectangle bottom_half() const \
|
278
|
+
{return Rectangle(point, size.x, size.y / T(2));} \
|
279
|
+
\
|
280
|
+
\
|
281
|
+
Z_CT(CPP11) Value2D<T> bottom_left() const \
|
282
|
+
{return point;} \
|
283
|
+
\
|
284
|
+
\
|
285
|
+
Z_CT(CPP11) Rectangle bottom_left_quarter() const \
|
286
|
+
{return Rectangle(point, size / T(2));} \
|
287
|
+
\
|
288
|
+
\
|
289
|
+
Z_CT(CPP11) Value2D<T> bottom_right() const \
|
290
|
+
{return Value2D<T>(point.x + size.x, point.y);} \
|
291
|
+
\
|
292
|
+
\
|
293
|
+
Z_CT(CPP11) Value2D<T> center() const \
|
294
|
+
{return point + size / T(2);} \
|
295
|
+
\
|
296
|
+
\
|
297
|
+
Z_CT(CPP11) Value2D<T> center_left() const \
|
298
|
+
{return Value2D<T>(point.x, point.y + size.y / T(2));} \
|
299
|
+
\
|
300
|
+
\
|
301
|
+
Z_CT(CPP11) Value2D<T> center_right() const \
|
302
|
+
{return Value2D<T>(point.x + size.x, point.y + size.y / T(2));} \
|
303
|
+
\
|
304
|
+
\
|
305
|
+
Z_CT(CPP11) Boolean contains(const Rectangle &other) const \
|
306
|
+
{ \
|
307
|
+
return !other.size.has_zero() && \
|
308
|
+
other.point >= point && \
|
309
|
+
other.point + other.size <= point + size; \
|
310
|
+
} \
|
311
|
+
\
|
312
|
+
\
|
313
|
+
/*Z_CT(CPP11) Boolean contains(const AABR<T> &aabr) const \
|
314
|
+
{ \
|
315
|
+
return aabr.a.x != aabr.b.x && \
|
316
|
+
aabr.a.y != aabr.b.y && \
|
317
|
+
aabr.a >= point && \
|
318
|
+
aabr.b <= point + size; \
|
319
|
+
}*/ \
|
320
|
+
\
|
321
|
+
\
|
322
|
+
Z_CT(CPP11) Boolean contains(const Value2D<T> &point) const \
|
323
|
+
{return point >= this->point && point < this->point + this->size;} \
|
324
|
+
\
|
325
|
+
\
|
326
|
+
Z_INLINE Rectangle &correct() \
|
327
|
+
{ \
|
328
|
+
if (size.x < T(0)) point.x -= (size.x = -size.x); \
|
329
|
+
if (size.y < T(0)) point.y -= (size.y = -size.y); \
|
330
|
+
return *this; \
|
331
|
+
} \
|
332
|
+
\
|
333
|
+
\
|
334
|
+
Z_CT(CPP14) Rectangle fit_in_bottom_center(const Value2D<T> &size) const \
|
335
|
+
{ \
|
336
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
337
|
+
\
|
338
|
+
return Rectangle \
|
339
|
+
(this->point.x + (this->size.x - fitting_size.x) / T(2), this->point.y, \
|
340
|
+
fitting_size); \
|
341
|
+
} \
|
342
|
+
\
|
343
|
+
\
|
344
|
+
Z_CT(CPP11) Rectangle fit_in_bottom_left(const Value2D<T> &size) const \
|
345
|
+
{return Rectangle(this->point, size.fit(this->size));} \
|
346
|
+
\
|
347
|
+
\
|
348
|
+
Z_CT(CPP14) Rectangle fit_in_bottom_right(const Value2D<T> &size) const \
|
349
|
+
{ \
|
350
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
351
|
+
\
|
352
|
+
return Rectangle \
|
353
|
+
(this->point.x + this->size.x - fitting_size.x, this->point.y, fitting_size); \
|
354
|
+
} \
|
355
|
+
\
|
356
|
+
\
|
357
|
+
Z_CT(CPP14) Rectangle fit_in_center(const Value2D<T> &size) const \
|
358
|
+
{ \
|
359
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
360
|
+
\
|
361
|
+
return Rectangle(this->point + (this->size - fitting_size) / T(2), fitting_size); \
|
362
|
+
} \
|
363
|
+
\
|
364
|
+
\
|
365
|
+
Z_CT(CPP14) Rectangle fit_in_center_left(const Value2D<T> &size) const \
|
366
|
+
{ \
|
367
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
368
|
+
\
|
369
|
+
return Rectangle \
|
370
|
+
(this->point.x, this->point.y + (this->size.y - fitting_size.y) / T(2), \
|
371
|
+
fitting_size); \
|
372
|
+
} \
|
373
|
+
\
|
374
|
+
\
|
375
|
+
Z_CT(CPP14) Rectangle fit_in_center_right(const Value2D<T> &size) const \
|
376
|
+
{ \
|
377
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
378
|
+
\
|
379
|
+
return Rectangle \
|
380
|
+
(this->point.x + this->size.x - fitting_size.x, \
|
381
|
+
this->point.y + (this->size.y - fitting_size.y) / T(2), \
|
382
|
+
fitting_size); \
|
383
|
+
} \
|
384
|
+
\
|
385
|
+
\
|
386
|
+
Z_CT(CPP14) Rectangle fit_in_top_center(const Value2D<T> &size) const \
|
387
|
+
{ \
|
388
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
389
|
+
\
|
390
|
+
return Rectangle \
|
391
|
+
(this->point.x + (this->size.x - fitting_size.x) / T(2), \
|
392
|
+
this->point.y + this->size.y - fitting_size.y, \
|
393
|
+
fitting_size); \
|
394
|
+
} \
|
395
|
+
\
|
396
|
+
\
|
397
|
+
Z_CT(CPP14) Rectangle fit_in_top_left(const Value2D<T> &size) const \
|
398
|
+
{ \
|
399
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
400
|
+
\
|
401
|
+
return Rectangle \
|
402
|
+
(this->point.x, this->point.y + this->size.y - fitting_size.y, fitting_size); \
|
403
|
+
} \
|
404
|
+
\
|
405
|
+
\
|
406
|
+
Z_CT(CPP14) Rectangle fit_in_top_right(const Value2D<T> &size) const \
|
407
|
+
{ \
|
408
|
+
Value2D<T> fitting_size = size.fit(this->size); \
|
409
|
+
\
|
410
|
+
return Rectangle(this->point + this->size - fitting_size, fitting_size); \
|
411
|
+
} \
|
412
|
+
\
|
413
|
+
\
|
414
|
+
Z_CT(CPP11) Rectangle grow_from_bottom_center(const Value2D<T> &delta) const \
|
415
|
+
{return Rectangle(point.x - delta.x / T(2), point.y, size + delta);} \
|
416
|
+
\
|
417
|
+
\
|
418
|
+
Z_CT(CPP11) Rectangle grow_from_bottom_left(const Value2D<T> &delta) const \
|
419
|
+
{return Rectangle(point, size + delta);} \
|
420
|
+
\
|
421
|
+
\
|
422
|
+
Z_CT(CPP11) Rectangle grow_from_bottom_right(const Value2D<T> &delta) const \
|
423
|
+
{return Rectangle(point.x - delta.x, point.y, size + delta);} \
|
424
|
+
\
|
425
|
+
\
|
426
|
+
Z_CT(CPP11) Rectangle grow_from_center(const Value2D<T> &delta) const \
|
427
|
+
{return Rectangle(point - delta / T(2), size + delta);} \
|
428
|
+
\
|
429
|
+
\
|
430
|
+
Z_CT(CPP11) Rectangle grow_from_center_left(const Value2D<T> &delta) const \
|
431
|
+
{return Rectangle(point.x, point.y - delta.y / T(2), size + delta);} \
|
432
|
+
\
|
433
|
+
\
|
434
|
+
Z_CT(CPP11) Rectangle grow_from_center_right(const Value2D<T> &delta) const \
|
435
|
+
{return Rectangle(point.x - delta.x, point.y - delta.y / T(2), size + delta);} \
|
436
|
+
\
|
437
|
+
\
|
438
|
+
Z_CT(CPP11) Rectangle grow_from_top_center(const Value2D<T> &delta) const \
|
439
|
+
{return Rectangle(point.x - delta.x / T(2), point.y - delta.y, size + delta);} \
|
440
|
+
\
|
441
|
+
\
|
442
|
+
Z_CT(CPP11) Rectangle grow_from_top_left(const Value2D<T> &delta) const \
|
443
|
+
{return Rectangle(point.x, point.y - delta.y, size + delta);} \
|
444
|
+
\
|
445
|
+
\
|
446
|
+
Z_CT(CPP11) Rectangle grow_from_top_right(const Value2D<T> &delta) const \
|
447
|
+
{return Rectangle(point - delta, size + delta);} \
|
448
|
+
\
|
449
|
+
\
|
450
|
+
Z_CT(CPP11) Rectangle grow_in_x_from_center(T delta) const \
|
451
|
+
{return Rectangle(point.x - delta / T(2), point.y, size.x + delta, size.y);} \
|
452
|
+
\
|
453
|
+
\
|
454
|
+
Z_CT(CPP11) Rectangle grow_in_x_from_left(T delta) const \
|
455
|
+
{return Rectangle(point, size.x + delta, size.y);} \
|
456
|
+
\
|
457
|
+
\
|
458
|
+
Z_CT(CPP11) Rectangle grow_in_x_from_right(T delta) const \
|
459
|
+
{return Rectangle(point.x - delta, point.y, size.x + delta, size.y);} \
|
460
|
+
\
|
461
|
+
\
|
462
|
+
Z_CT(CPP11) Rectangle grow_in_y_from_bottom(T delta) const \
|
463
|
+
{return Rectangle(point, size.x, size.y + delta);} \
|
464
|
+
\
|
465
|
+
\
|
466
|
+
Z_CT(CPP11) Rectangle grow_in_y_from_center(T delta) const \
|
467
|
+
{return Rectangle(point.x, point.y - delta / T(2), size.x, size.y + delta);} \
|
468
|
+
\
|
469
|
+
\
|
470
|
+
Z_CT(CPP11) Rectangle grow_in_y_from_top(T delta) const \
|
471
|
+
{return Rectangle(point.x, point.y - delta, size.x, size.y + delta);} \
|
472
|
+
\
|
473
|
+
\
|
474
|
+
Z_CT(CPP11) Boolean intersects(const Rectangle &other) const \
|
475
|
+
{ \
|
476
|
+
return !size.has_zero() && \
|
477
|
+
!other.size.has_zero() && \
|
478
|
+
other.point + other.size > point && \
|
479
|
+
other.point < point + size; \
|
480
|
+
} \
|
481
|
+
\
|
482
|
+
\
|
483
|
+
Z_CT(CPP11) Boolean is_zero() const \
|
484
|
+
{return point.is_zero() && size.is_zero();} \
|
485
|
+
\
|
486
|
+
\
|
487
|
+
Z_CT(CPP11) Rectangle left_half () const \
|
488
|
+
{return Rectangle(point, size.x / T(2), size.y);} \
|
489
|
+
\
|
490
|
+
\
|
491
|
+
Z_CT(CPP11) T maximum_x() const \
|
492
|
+
{return point.x + size.x;} \
|
493
|
+
\
|
494
|
+
\
|
495
|
+
Z_CT(CPP11) T maximum_y() const \
|
496
|
+
{return point.y + size.y;} \
|
497
|
+
\
|
498
|
+
\
|
499
|
+
Z_CT(CPP11) T middle_x() const \
|
500
|
+
{return point.x + size.x / T(2);} \
|
501
|
+
\
|
502
|
+
\
|
503
|
+
Z_CT(CPP11) T middle_y() const \
|
504
|
+
{return point.y + size.y / T(2);} \
|
505
|
+
\
|
506
|
+
\
|
507
|
+
Z_CT(CPP11) T minimum_x() \
|
508
|
+
const {return point.x;} \
|
509
|
+
\
|
510
|
+
\
|
511
|
+
Z_CT(CPP11) T minimum_y() \
|
512
|
+
const {return point.y;} \
|
513
|
+
\
|
514
|
+
\
|
515
|
+
Z_CT(CPP11) Rectangle shrink_from_bottom_center(const Value2D<T> &delta) const \
|
516
|
+
{return Rectangle(point.x + delta.x / T(2), point.y, size - delta);} \
|
517
|
+
\
|
518
|
+
\
|
519
|
+
Z_CT(CPP11) Rectangle shrink_from_bottom_left(const Value2D<T> &delta) const \
|
520
|
+
{return Rectangle(point, size - delta);} \
|
521
|
+
\
|
522
|
+
\
|
523
|
+
Z_CT(CPP11) Rectangle shrink_from_bottom_right(const Value2D<T> &delta) const \
|
524
|
+
{return Rectangle(point.x + delta.x, point.y, size - delta);} \
|
525
|
+
\
|
526
|
+
\
|
527
|
+
Z_CT(CPP11) Rectangle shrink_from_center(const Value2D<T> &delta) const \
|
528
|
+
{return Rectangle(point + delta / T(2), size - delta);} \
|
529
|
+
\
|
530
|
+
\
|
531
|
+
Z_CT(CPP11) Rectangle shrink_from_center_left(const Value2D<T> &delta) const \
|
532
|
+
{return Rectangle(point.x, point.y + delta.y / T(2), size - delta);} \
|
533
|
+
\
|
534
|
+
\
|
535
|
+
Z_CT(CPP11) Rectangle shrink_from_center_right(const Value2D<T> &delta) const \
|
536
|
+
{return Rectangle(point.x + delta.x, point.y + delta.y / T(2), size - delta);} \
|
537
|
+
\
|
538
|
+
\
|
539
|
+
Z_CT(CPP11) Rectangle shrink_from_top_center(const Value2D<T> &delta) const \
|
540
|
+
{return Rectangle(point.x + delta.x / T(2), point.y + delta.y, size - delta);} \
|
541
|
+
\
|
542
|
+
\
|
543
|
+
Z_CT(CPP11) Rectangle shrink_from_top_left(const Value2D<T> &delta) const \
|
544
|
+
{return Rectangle(point.x, point.y + delta.y, size - delta);} \
|
545
|
+
\
|
546
|
+
\
|
547
|
+
Z_CT(CPP11) Rectangle shrink_from_top_right(const Value2D<T> &delta) const \
|
548
|
+
{return Rectangle(point + delta, size - delta);} \
|
549
|
+
\
|
550
|
+
\
|
551
|
+
Z_CT(CPP11) Rectangle shrink_in_x_from_center(T delta) const \
|
552
|
+
{return Rectangle(point.x + delta / T(2), point.y, size.x - delta, size.y);} \
|
553
|
+
\
|
554
|
+
\
|
555
|
+
Z_CT(CPP11) Rectangle shrink_in_x_from_left(T delta) const \
|
556
|
+
{return Rectangle(point, size.x - delta, size.y);} \
|
557
|
+
\
|
558
|
+
\
|
559
|
+
Z_CT(CPP11) Rectangle shrink_in_x_from_right(T delta) const \
|
560
|
+
{return Rectangle(point.x + delta, point.y, size.x - delta, size.y);} \
|
561
|
+
\
|
562
|
+
\
|
563
|
+
Z_CT(CPP11) Rectangle shrink_in_y_from_bottom(T delta) const \
|
564
|
+
{return Rectangle(point, size.x, size.y - delta);} \
|
565
|
+
\
|
566
|
+
\
|
567
|
+
Z_CT(CPP11) Rectangle shrink_in_y_from_center(T delta) const \
|
568
|
+
{return Rectangle(point.x, point.y + delta / T(2), size.x, size.y - delta);} \
|
569
|
+
\
|
570
|
+
\
|
571
|
+
Z_CT(CPP11) Rectangle shrink_in_y_from_top(T delta) const \
|
572
|
+
{return Rectangle(point.x, point.y + delta, size.x, size.y - delta);} \
|
573
|
+
\
|
574
|
+
\
|
575
|
+
Z_INLINE void swap(Rectangle &other) \
|
576
|
+
{Zeta::swap<Base>((Base *)this, (Base *)&other);} \
|
577
|
+
\
|
578
|
+
\
|
579
|
+
Z_CT(CPP11) Value2D<T> top_center() const \
|
580
|
+
{return Value2D<T>(point.x + size.x / T(2), point.y + size.y);} \
|
581
|
+
\
|
582
|
+
\
|
583
|
+
Z_CT(CPP11) Value2D<T> top_left() const \
|
584
|
+
{return Value2D<T>(point.x, point.y + size.y);} \
|
585
|
+
\
|
586
|
+
\
|
587
|
+
Z_CT(CPP11) Value2D<T> top_right() const \
|
588
|
+
{return point + size;}
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
namespace Zeta {
|
594
|
+
template <class T, UInt T_number_set = Type<T>::number_set> struct Rectangle {};
|
595
|
+
|
596
|
+
|
597
|
+
template <class T> struct Rectangle<T, Z_NUMBER_SET_Z> {
|
598
|
+
Z_IMPLEMENTATION_COMMON
|
599
|
+
|
600
|
+
|
601
|
+
Z_CT(CPP11) Rectangle bottom_right_quarter() const
|
602
|
+
{return Rectangle(point.x + size.x / T(2), point.y, size.x - size.x / T(2), size.y / T(2));}
|
603
|
+
|
604
|
+
|
605
|
+
Z_CT(CPP11) Rectangle right_half() const
|
606
|
+
{return Rectangle(point.x + size.x / T(2), point.y, size.x - size.x / T(2), size.y);}
|
607
|
+
|
608
|
+
|
609
|
+
Z_CT(CPP11) Rectangle top_half() const
|
610
|
+
{return Rectangle(point.x, point.y + size.y / T(2), size.x, size.y - size.y / T(2));}
|
611
|
+
|
612
|
+
|
613
|
+
Z_CT(CPP11) Rectangle top_left_quarter() const
|
614
|
+
{return Rectangle(point.x, point.y + size.y / T(2), size.x / T(2), size.y - size.y / T(2));}
|
615
|
+
|
616
|
+
|
617
|
+
Z_CT(CPP11) Rectangle top_right_quarter() const
|
618
|
+
{return Rectangle(point + size / T(2), size - size / T(2));}
|
619
|
+
};
|
620
|
+
|
621
|
+
|
622
|
+
template <class T> struct Rectangle<T, Z_NUMBER_SET_R> {
|
623
|
+
Z_IMPLEMENTATION_COMMON
|
624
|
+
|
625
|
+
|
626
|
+
Z_CT(CPP11) Value2D<T> absolute_point_to_unit(const Value2D<T> &point) const
|
627
|
+
{return (point - this->point) / this->size;}
|
628
|
+
|
629
|
+
|
630
|
+
Z_CT(CPP11) Rectangle bottom_right_quarter() const
|
631
|
+
{return Rectangle(point.x + size.x / T(2), point.y, size / T(2));}
|
632
|
+
|
633
|
+
|
634
|
+
/*Z_CT(CPP11) Boolean contains(const Circle<T> &circle) const
|
635
|
+
{
|
636
|
+
return circle.radius != T(0) &&
|
637
|
+
circle.point - circle.radius >= point &&
|
638
|
+
circle.point + circle.radius <= point + size;
|
639
|
+
}*/
|
640
|
+
|
641
|
+
|
642
|
+
/*Z_CT(CPP11) Circle<T> inner_circle() const
|
643
|
+
{return Circle<T>(center(), size.inner_minimum() / T(2));}*/
|
644
|
+
|
645
|
+
|
646
|
+
Z_CT(CPP11) Rectangle right_half() const
|
647
|
+
{return Rectangle(point.x + size.x / T(2), point.y, size.x / T(2), size.y);}
|
648
|
+
|
649
|
+
|
650
|
+
Z_CT(CPP11) Rectangle top_half() const
|
651
|
+
{return Rectangle(point.x, point.y + size.y / T(2), size.x, size.y / T(2));}
|
652
|
+
|
653
|
+
|
654
|
+
Z_CT(CPP11) Rectangle top_left_quarter() const
|
655
|
+
{return Rectangle(point.x, point.y + size.y / T(2), size / T(2));}
|
656
|
+
|
657
|
+
|
658
|
+
Z_CT(CPP11) Rectangle top_right_quarter() const
|
659
|
+
{return Rectangle(point + size / T(2), size / T(2));}
|
660
|
+
|
661
|
+
|
662
|
+
Z_CT(CPP11) Value2D<T> unit_point_to_absolute(const Value2D<T> &point) const
|
663
|
+
{return point * size + point;}
|
664
|
+
};
|
665
|
+
}
|
666
|
+
|
667
|
+
|
668
|
+
#undef Z_IMPLEMENTATION_FOUNDATION_CONSTRUCTOR
|
669
|
+
#undef Z_IMPLEMENTATION_FOUNDATION_OPERATOR
|
670
|
+
#undef Z_IMPLEMENTATION_CG_GEOMETRY
|
671
|
+
#undef Z_IMPLEMENTATION_NS_GEOMETRY
|
672
|
+
#undef Z_IMPLEMENTATION_COCOS2D_X
|
673
|
+
#undef Z_IMPLEMENTATION_COMMON
|
674
|
+
|
675
|
+
#endif // _Z_classes_mathematics_geometry_euclidean_Rectangle_HPP_
|
File without changes
|