From 7ad25021e74ea26e33d705fbb402d29aabaf6314 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 1 Nov 2022 03:01:47 +0000 Subject: CTAN sync 202211010301 --- .../metapost/contrib/macros/hershey-mp/LICENSE | 287 +++++++++ graphics/metapost/contrib/macros/hershey-mp/README | 18 + .../metapost/contrib/macros/hershey-mp/hershey.mp | 84 +++ .../metapost/contrib/macros/hershey-mp/hershey.pdf | Bin 0 -> 285317 bytes .../metapost/contrib/macros/hershey-mp/hershey.tex | 156 +++++ graphics/pgf/contrib/tikz-ext/README.md | 1 - .../tikz-ext-manual-en-library-scalepicture.tex | 113 ++++ .../tikz-ext/doc/tikz-ext-manual-en-main-body.tex | 9 +- .../doc/tikz-ext-manual-en-main-preamble.tex | 1 + .../pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf | Bin 574442 -> 424759 bytes .../pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex | 4 +- .../tikz-ext/tex/generic/pgfcalendar-ext.code.tex | 370 +++++++++++ .../pgfkeyslibraryext.pgfkeys-plus.code.tex | 139 +++++ .../generic/pgflibraryext.pgfkeys-plus.code.tex | 11 + .../pgflibraryext.shapes.circlearrow.code.tex | 66 ++ .../pgflibraryext.shapes.circlecrosssplit.code.tex | 292 +++++++++ .../generic/pgflibraryext.shapes.heatmark.code.tex | 181 ++++++ ...raryext.shapes.rectangleroundedcorners.code.tex | 318 ++++++++++ .../pgflibraryext.shapes.superellipse.code.tex | 198 ++++++ ...flibraryext.shapes.uncenteredrectangle.code.tex | 307 +++++++++ .../pgflibraryext.transformations.mirror.code.tex | 96 +++ .../tex/generic/tikz-ext/pgfcalendar-ext.code.tex | 370 ----------- .../pgfkeyslibraryext.pgfkeys-plus.code.tex | 139 ----- .../tikz-ext/pgflibraryext.pgfkeys-plus.code.tex | 11 - .../pgflibraryext.shapes.circlearrow.code.tex | 66 -- .../pgflibraryext.shapes.circlecrosssplit.code.tex | 292 --------- .../pgflibraryext.shapes.heatmark.code.tex | 181 ------ ...raryext.shapes.rectangleroundedcorners.code.tex | 318 ---------- .../pgflibraryext.shapes.superellipse.code.tex | 198 ------ ...flibraryext.shapes.uncenteredrectangle.code.tex | 307 --------- .../pgflibraryext.transformations.mirror.code.tex | 96 --- .../tikz-ext/tikzlibraryext.calendar-plus.code.tex | 93 --- .../generic/tikz-ext/tikzlibraryext.misc.code.tex | 180 ------ .../tikz-ext/tikzlibraryext.node-families.code.tex | 339 ---------- ...raryext.node-families.shapes.geometric.code.tex | 38 -- .../tikz-ext/tikzlibraryext.paths.arcto.code.tex | 326 ---------- .../tikz-ext/tikzlibraryext.paths.ortho.code.tex | 692 -------------------- .../tikz-ext/tikzlibraryext.paths.timer.code.tex | 188 ------ .../tikzlibraryext.patterns.images.code.tex | 60 -- .../tikzlibraryext.positioning-plus.code.tex | 262 -------- .../tikzlibraryext.topaths.arcthrough.code.tex | 50 -- .../tikzlibraryext.transformations.mirror.code.tex | 130 ---- .../generic/tikzlibraryext.calendar-plus.code.tex | 93 +++ .../tex/generic/tikzlibraryext.misc.code.tex | 180 ++++++ .../generic/tikzlibraryext.node-families.code.tex | 339 ++++++++++ ...raryext.node-families.shapes.geometric.code.tex | 38 ++ .../generic/tikzlibraryext.paths.arcto.code.tex | 326 ++++++++++ .../generic/tikzlibraryext.paths.ortho.code.tex | 693 +++++++++++++++++++++ .../generic/tikzlibraryext.paths.timer.code.tex | 188 ++++++ .../tikzlibraryext.patterns.images.code.tex | 60 ++ .../tikzlibraryext.positioning-plus.code.tex | 262 ++++++++ .../generic/tikzlibraryext.scalepicture.code.tex | 194 ++++++ .../tikzlibraryext.topaths.arcthrough.code.tex | 50 ++ .../tikzlibraryext.transformations.mirror.code.tex | 130 ++++ .../contrib/tikz-ext/tex/latex/pgfcalendar-ext.sty | 11 + .../tex/latex/tikz-ext/pgfcalendar-ext.sty | 11 - .../contrib/tikz-ext/tex/plain/pgfcalendar-ext.tex | 13 + .../tex/plain/tikz-ext/pgfcalendar-ext.tex | 13 - 58 files changed, 5224 insertions(+), 4364 deletions(-) create mode 100644 graphics/metapost/contrib/macros/hershey-mp/LICENSE create mode 100644 graphics/metapost/contrib/macros/hershey-mp/README create mode 100644 graphics/metapost/contrib/macros/hershey-mp/hershey.mp create mode 100644 graphics/metapost/contrib/macros/hershey-mp/hershey.pdf create mode 100644 graphics/metapost/contrib/macros/hershey-mp/hershey.tex create mode 100644 graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-scalepicture.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgfcalendar-ext.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlearrow.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlecrosssplit.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.heatmark.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.rectangleroundedcorners.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.superellipse.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.uncenteredrectangle.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.transformations.mirror.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfcalendar-ext.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.pgfkeys-plus.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlearrow.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlecrosssplit.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.heatmark.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.rectangleroundedcorners.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.superellipse.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.transformations.mirror.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.shapes.geometric.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.arcto.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.ortho.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.patterns.images.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.positioning-plus.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.transformations.mirror.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.calendar-plus.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.shapes.geometric.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.arcto.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.ortho.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.timer.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.patterns.images.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.positioning-plus.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.scalepicture.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.topaths.arcthrough.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.transformations.mirror.code.tex create mode 100644 graphics/pgf/contrib/tikz-ext/tex/latex/pgfcalendar-ext.sty delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/latex/tikz-ext/pgfcalendar-ext.sty create mode 100644 graphics/pgf/contrib/tikz-ext/tex/plain/pgfcalendar-ext.tex delete mode 100644 graphics/pgf/contrib/tikz-ext/tex/plain/tikz-ext/pgfcalendar-ext.tex (limited to 'graphics') diff --git a/graphics/metapost/contrib/macros/hershey-mp/LICENSE b/graphics/metapost/contrib/macros/hershey-mp/LICENSE new file mode 100644 index 0000000000..4153cd3775 --- /dev/null +++ b/graphics/metapost/contrib/macros/hershey-mp/LICENSE @@ -0,0 +1,287 @@ + EUROPEAN UNION PUBLIC LICENCE v. 1.2 + EUPL © the European Union 2007, 2016 + +This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined +below) which is provided under the terms of this Licence. Any use of the Work, +other than as authorised under this Licence is prohibited (to the extent such +use is covered by a right of the copyright holder of the Work). + +The Work is provided under the terms of this Licence when the Licensor (as +defined below) has placed the following notice immediately following the +copyright notice for the Work: + + Licensed under the EUPL + +or has expressed by any other means his willingness to license under the EUPL. + +1. Definitions + +In this Licence, the following terms have the following meaning: + +- ‘The Licence’: this Licence. + +- ‘The Original Work’: the work or software distributed or communicated by the + Licensor under this Licence, available as Source Code and also as Executable + Code as the case may be. + +- ‘Derivative Works’: the works or software that could be created by the + Licensee, based upon the Original Work or modifications thereof. This Licence + does not define the extent of modification or dependence on the Original Work + required in order to classify a work as a Derivative Work; this extent is + determined by copyright law applicable in the country mentioned in Article 15. + +- ‘The Work’: the Original Work or its Derivative Works. + +- ‘The Source Code’: the human-readable form of the Work which is the most + convenient for people to study and modify. + +- ‘The Executable Code’: any code which has generally been compiled and which is + meant to be interpreted by a computer as a program. + +- ‘The Licensor’: the natural or legal person that distributes or communicates + the Work under the Licence. + +- ‘Contributor(s)’: any natural or legal person who modifies the Work under the + Licence, or otherwise contributes to the creation of a Derivative Work. + +- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of + the Work under the terms of the Licence. + +- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending, + renting, distributing, communicating, transmitting, or otherwise making + available, online or offline, copies of the Work or providing access to its + essential functionalities at the disposal of any other natural or legal + person. + +2. Scope of the rights granted by the Licence + +The Licensor hereby grants You a worldwide, royalty-free, non-exclusive, +sublicensable licence to do the following, for the duration of copyright vested +in the Original Work: + +- use the Work in any circumstance and for all usage, +- reproduce the Work, +- modify the Work, and make Derivative Works based upon the Work, +- communicate to the public, including the right to make available or display + the Work or copies thereof to the public and perform publicly, as the case may + be, the Work, +- distribute the Work or copies thereof, +- lend and rent the Work or copies thereof, +- sublicense rights in the Work or copies thereof. + +Those rights can be exercised on any media, supports and formats, whether now +known or later invented, as far as the applicable law permits so. + +In the countries where moral rights apply, the Licensor waives his right to +exercise his moral right to the extent allowed by law in order to make effective +the licence of the economic rights here above listed. + +The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to +any patents held by the Licensor, to the extent necessary to make use of the +rights granted on the Work under this Licence. + +3. Communication of the Source Code + +The Licensor may provide the Work either in its Source Code form, or as +Executable Code. If the Work is provided as Executable Code, the Licensor +provides in addition a machine-readable copy of the Source Code of the Work +along with each copy of the Work that the Licensor distributes or indicates, in +a notice following the copyright notice attached to the Work, a repository where +the Source Code is easily and freely accessible for as long as the Licensor +continues to distribute or communicate the Work. + +4. Limitations on copyright + +Nothing in this Licence is intended to deprive the Licensee of the benefits from +any exception or limitation to the exclusive rights of the rights owners in the +Work, of the exhaustion of those rights or of other applicable limitations +thereto. + +5. Obligations of the Licensee + +The grant of the rights mentioned above is subject to some restrictions and +obligations imposed on the Licensee. Those obligations are the following: + +Attribution right: The Licensee shall keep intact all copyright, patent or +trademarks notices and all notices that refer to the Licence and to the +disclaimer of warranties. The Licensee must include a copy of such notices and a +copy of the Licence with every copy of the Work he/she distributes or +communicates. The Licensee must cause any Derivative Work to carry prominent +notices stating that the Work has been modified and the date of modification. + +Copyleft clause: If the Licensee distributes or communicates copies of the +Original Works or Derivative Works, this Distribution or Communication will be +done under the terms of this Licence or of a later version of this Licence +unless the Original Work is expressly distributed only under this version of the +Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee +(becoming Licensor) cannot offer or impose any additional terms or conditions on +the Work or Derivative Work that alter or restrict the terms of the Licence. + +Compatibility clause: If the Licensee Distributes or Communicates Derivative +Works or copies thereof based upon both the Work and another work licensed under +a Compatible Licence, this Distribution or Communication can be done under the +terms of this Compatible Licence. For the sake of this clause, ‘Compatible +Licence’ refers to the licences listed in the appendix attached to this Licence. +Should the Licensee's obligations under the Compatible Licence conflict with +his/her obligations under this Licence, the obligations of the Compatible +Licence shall prevail. + +Provision of Source Code: When distributing or communicating copies of the Work, +the Licensee will provide a machine-readable copy of the Source Code or indicate +a repository where this Source will be easily and freely available for as long +as the Licensee continues to distribute or communicate the Work. + +Legal Protection: This Licence does not grant permission to use the trade names, +trademarks, service marks, or names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the copyright notice. + +6. Chain of Authorship + +The original Licensor warrants that the copyright in the Original Work granted +hereunder is owned by him/her or licensed to him/her and that he/she has the +power and authority to grant the Licence. + +Each Contributor warrants that the copyright in the modifications he/she brings +to the Work are owned by him/her or licensed to him/her and that he/she has the +power and authority to grant the Licence. + +Each time You accept the Licence, the original Licensor and subsequent +Contributors grant You a licence to their contributions to the Work, under the +terms of this Licence. + +7. Disclaimer of Warranty + +The Work is a work in progress, which is continuously improved by numerous +Contributors. It is not a finished work and may therefore contain defects or +‘bugs’ inherent to this type of development. + +For the above reason, the Work is provided under the Licence on an ‘as is’ basis +and without warranties of any kind concerning the Work, including without +limitation merchantability, fitness for a particular purpose, absence of defects +or errors, accuracy, non-infringement of intellectual property rights other than +copyright as stated in Article 6 of this Licence. + +This disclaimer of warranty is an essential part of the Licence and a condition +for the grant of any rights to the Work. + +8. Disclaimer of Liability + +Except in the cases of wilful misconduct or damages directly caused to natural +persons, the Licensor will in no event be liable for any direct or indirect, +material or moral, damages of any kind, arising out of the Licence or of the use +of the Work, including without limitation, damages for loss of goodwill, work +stoppage, computer failure or malfunction, loss of data or any commercial +damage, even if the Licensor has been advised of the possibility of such damage. +However, the Licensor will be liable under statutory product liability laws as +far such laws apply to the Work. + +9. Additional agreements + +While distributing the Work, You may choose to conclude an additional agreement, +defining obligations or services consistent with this Licence. However, if +accepting obligations, You may act only on your own behalf and on your sole +responsibility, not on behalf of the original Licensor or any other Contributor, +and only if You agree to indemnify, defend, and hold each Contributor harmless +for any liability incurred by, or claims asserted against such Contributor by +the fact You have accepted any warranty or additional liability. + +10. Acceptance of the Licence + +The provisions of this Licence can be accepted by clicking on an icon ‘I agree’ +placed under the bottom of a window displaying the text of this Licence or by +affirming consent in any other similar way, in accordance with the rules of +applicable law. Clicking on that icon indicates your clear and irrevocable +acceptance of this Licence and all of its terms and conditions. + +Similarly, you irrevocably accept this Licence and all of its terms and +conditions by exercising any rights granted to You by Article 2 of this Licence, +such as the use of the Work, the creation by You of a Derivative Work or the +Distribution or Communication by You of the Work or copies thereof. + +11. Information to the public + +In case of any Distribution or Communication of the Work by means of electronic +communication by You (for example, by offering to download the Work from a +remote location) the distribution channel or media (for example, a website) must +at least provide to the public the information requested by the applicable law +regarding the Licensor, the Licence and the way it may be accessible, concluded, +stored and reproduced by the Licensee. + +12. Termination of the Licence + +The Licence and the rights granted hereunder will terminate automatically upon +any breach by the Licensee of the terms of the Licence. + +Such a termination will not terminate the licences of any person who has +received the Work from the Licensee under the Licence, provided such persons +remain in full compliance with the Licence. + +13. Miscellaneous + +Without prejudice of Article 9 above, the Licence represents the complete +agreement between the Parties as to the Work. + +If any provision of the Licence is invalid or unenforceable under applicable +law, this will not affect the validity or enforceability of the Licence as a +whole. Such provision will be construed or reformed so as necessary to make it +valid and enforceable. + +The European Commission may publish other linguistic versions or new versions of +this Licence or updated versions of the Appendix, so far this is required and +reasonable, without reducing the scope of the rights granted by the Licence. New +versions of the Licence will be published with a unique version number. + +All linguistic versions of this Licence, approved by the European Commission, +have identical value. Parties can take advantage of the linguistic version of +their choice. + +14. Jurisdiction + +Without prejudice to specific agreement between parties, + +- any litigation resulting from the interpretation of this License, arising + between the European Union institutions, bodies, offices or agencies, as a + Licensor, and any Licensee, will be subject to the jurisdiction of the Court + of Justice of the European Union, as laid down in article 272 of the Treaty on + the Functioning of the European Union, + +- any litigation arising between other parties and resulting from the + interpretation of this License, will be subject to the exclusive jurisdiction + of the competent court where the Licensor resides or conducts its primary + business. + +15. Applicable Law + +Without prejudice to specific agreement between parties, + +- this Licence shall be governed by the law of the European Union Member State + where the Licensor has his seat, resides or has his registered office, + +- this licence shall be governed by Belgian law if the Licensor has no seat, + residence or registered office inside a European Union Member State. + +Appendix + +‘Compatible Licences’ according to Article 5 EUPL are: + +- GNU General Public License (GPL) v. 2, v. 3 +- GNU Affero General Public License (AGPL) v. 3 +- Open Software License (OSL) v. 2.1, v. 3.0 +- Eclipse Public License (EPL) v. 1.0 +- CeCILL v. 2.0, v. 2.1 +- Mozilla Public Licence (MPL) v. 2 +- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3 +- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for + works other than software +- European Union Public Licence (EUPL) v. 1.1, v. 1.2 +- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong + Reciprocity (LiLiQ-R+). + +The European Commission may update this Appendix to later versions of the above +licences without producing a new version of the EUPL, as long as they provide +the rights granted in Article 2 of this Licence and protect the covered Source +Code from exclusive appropriation. + +All other changes or additions to this Appendix require the production of a new +EUPL version. diff --git a/graphics/metapost/contrib/macros/hershey-mp/README b/graphics/metapost/contrib/macros/hershey-mp/README new file mode 100644 index 0000000000..4c5c6ad8dc --- /dev/null +++ b/graphics/metapost/contrib/macros/hershey-mp/README @@ -0,0 +1,18 @@ +SUMMARY + +This metapost file adds support for reading jhl vector font files, used by +(mostly? only?) the so-called Hershey Fonts of the late 1960s. + +It does not include the actual font files, which you can probably find in the +software repository included with your operating system. + + +COPYING + +(c) 2022 Esger Renkema + +These files may be distributed under the terms of the European Union Public +Licence (EUPL) version 1.2 or later. A copy can be obtained at: + +https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 + diff --git a/graphics/metapost/contrib/macros/hershey-mp/hershey.mp b/graphics/metapost/contrib/macros/hershey-mp/hershey.mp new file mode 100644 index 0000000000..80b7a0d105 --- /dev/null +++ b/graphics/metapost/contrib/macros/hershey-mp/hershey.mp @@ -0,0 +1,84 @@ + +if known loadHershey: expandafter endinput fi + +% this default is for Debian with ‘hershey-fonts-data’ installed. +newinternal string hersheyFonts; +hersheyFonts := "/usr/share/hershey-fonts/"; + +vardef loadHershey @# = + if known hershey.loaded.@# : + message("Hershey font "&str(@#)&" already known: skipping rereading."); + else: + hershey.loaded.font := 1; + doLoadHershey.@# ; + fi +enddef; +vardef doLoadHershey suffix font = + % create the variable hershey. + save var; string var; var := "hershey." & str font & "."; + scantokens ("path "&var)[][]; + % variables used for reading the file + save file, line; + string file, line; + file := hersheyFonts & str font & ".jhf"; + save pnum, lnum, wd, i, x, y, first; + boolean first; lnum := 0; + % read the font line by line + forever : + line := readfrom file; + exitif line = EOF; + lnum := lnum + 1; pnum := 1; first := true; + % the line starts with a width, followed by min/max x coordinates, + % followed by the data describing the glyph, in pairs of coordinates, + % every coördinate encoded as a single character. + wd := scantokens (substring(5,8) of line) - 1; + if wd > 0 : + line := substring (8, infinity) of line; + x := ASCII(line) - 82; line := substring(1, infinity) of line; + y := ASCII(line) - 82; line := substring(1, infinity) of line; + scantokens(var)[lnum].lft := x; + scantokens(var)[lnum].rt := y; + %message char(lnum+31) & " (" & decimal(lnum) & "): (" & decimal x & ", " & decimal y & ")"; + scantokens(var)[lnum][pnum] := fi + for i = 1 upto wd : + hide( % 82 is ASCII("R") + x := ASCII(line) - 82; line := substring(1, infinity) of line; + y := 82 - ASCII(line); line := substring(1, infinity) of line;) + if (x,y) = (-50,0) : + % the special string " R" separates paths + ; pnum := pnum+1; first := true; + scantokens(var)[lnum][pnum] := + else : + if first : hide(first := false) + else : -- fi (x,y) + fi + endfor; + endfor + closefrom file; +enddef; + +vardef drawHershey @# (expr s) text t = + if numeric s: drawHersheyChar @# (s) t; + else : drawHersheyString @# (s) t; fi +enddef; +vardef drawHersheyChar @# (expr c) text t = + save i; i := 1; forever : + exitif unknown hershey.@#[c][i]; + draw hershey.@#[c][i] t; + i := i + 1; + endfor +enddef; +vardef drawHersheyString @# (expr s) text t = + save c, ss, sh; string ss; ss := s; sh := 0; + forever : + c := ASCII(ss) - 31; + sh := sh + hershey.@#[c].rt; + % NB. -9 is the baseline of the hershey fonts; + % we put the baseline on x=0 instead. + drawHersheyChar @# (c) shifted (sh, 9) t; + sh := sh - hershey.@#[c].lft; + ss := substring(1, infinity) of ss; + exitif length(ss) = 0; + endfor +enddef; + diff --git a/graphics/metapost/contrib/macros/hershey-mp/hershey.pdf b/graphics/metapost/contrib/macros/hershey-mp/hershey.pdf new file mode 100644 index 0000000000..d6a47d817f Binary files /dev/null and b/graphics/metapost/contrib/macros/hershey-mp/hershey.pdf differ diff --git a/graphics/metapost/contrib/macros/hershey-mp/hershey.tex b/graphics/metapost/contrib/macros/hershey-mp/hershey.tex new file mode 100644 index 0000000000..70138b7b4a --- /dev/null +++ b/graphics/metapost/contrib/macros/hershey-mp/hershey.tex @@ -0,0 +1,156 @@ + +\input minim-doc.sty +\closeout0 + +\newmetapostinstance\hershey +\runmetapost\hershey{ + input "hershey"; + loadHershey timesib; +} + +\def\chapter#1\hfill#2\par{% + \startelement{Chapter}% + \outline open {#1}% + \nextpartag{H}\quitvmode + \startelement{Span}% + \red{\runmetapostimage\hershey{ + baseline origin; + pickup pencircle scaled .4pt; + drawHershey timesib ("hershey.mp") withcolor .75red; + }\setactualtext{hershey.mp}% + \stopelement{Span}% + \hfill#2\bigskip\nobreak}} + +\def\mailname{hershey} +\startmetadata + author {Esger Renkema} + title {hershey.mp} + date {2022-08-24} + version {2022/1.0} + keywords {MetaPost; Hershey fonts} +stopmetadata + +\maketitle + +This package can read the ⟦jhl⟧ format, used for the well known Hershey Fonts. +Use it like so: + +⟦% Where to look for font files (this is also the default) +hersheyFonts := "/usr/share/hershey-fonts/"; +% Load the font you want to use +loadHershey timesib; +% Draw a character +beginfig(1) + drawHershey timesib(7) rotated 180 withcolor .75red; +endfig; +% Or typeset a string +beginfig(2) + drawHershey timesib("Hello!") withcolor .75red; +endfig;⟧ + +This results in the following pictures: + +\bigskip\strut\hfill +\startelement{Figure} +\setalttext{An upside-down ampersand.} +\runmetapostimage \hershey { +baseline origin; +drawHershey timesib(7) rotated 180 withcolor .75red;} +\stopelement{Figure} +\hfill and\hfill +\startelement{Figure} +\setalttext{The text ‘Hello!’.} +\runmetapostimage \hershey { +baseline origin; +drawHershey timesib("Hello!") withcolor .75red;} +\stopelement{Figure} +\hfill\strut\bigskip + +Typesetting a string will only make sense for the latin fonts, where Hershey’s +encoding is in ASCII order. For strings, the baseline is adjusted upward by 9~units. + +Typical x-height is 14 units (of which 9 are below $y=0$), with an em-space of 21 units. + +The paths that make up each character are available to you in the array +⟦hershey.[][]⟧. You will rarely need this, however, since the trailing tokens to ⟦drawHershey⟧ will be applied to all paths. + +Proof sheets of Hershey’s original fonts are included in the following pages. + +\licencesection \stopelement{Section} + +\font\fiverm {Latin Modern Roman:script=latn;protrusion=default;} at 5pt +\runmetapost \hershey { +vardef testfont suffix name = + save c; c := 1; + for i = 1 upto 7: draw (45i+22.5,-22.5) -- (45i+22.5,-45*12-22.5); endfor + for j = 1 upto 11: draw (22.5, -45j-22.5) -- (45*8+22.5, -45j-22.5); endfor + for i = 1 upto 8: + for j = 1 upto 12: + drawHershey.name(c) shifted 45(i,-j); + draw maketext("{\fiverm "&decimal c&"}") shifted (45(i,-j) + (13,16)); + c := c + 1; + endfor + endfor + setbounds currentpicture to + unitsquare xscaled 8 yscaled -12 scaled 45 shifted (22.5, -22.5); +enddef; } + +\def\testfont#1 #2 {\vfil\break +\chapter{#1}{#2}% +\startelement{Figure} +\setalttext{A listing of the ‘#2’ font.} +\stoptagging +\runmetapostimage \hershey { testfont #2; } +\starttagging +\stopelement{Figure}} + +\def\chapter#1#2{% + \ensurestopelement{Section}% + \startelement{Chapter}% + \outline open {#2}% + \nextpartag{H}\quitvmode + \vrule depth 20pt height 35pt width 0pt\relax + \startelement{Span}% + \red{\runmetapostimage\hershey{ + loadHershey #2; + baseline origin; + pickup pencircle scaled .4pt; + drawHershey #1 ("#2") withcolor .75red; + }}\setactualtext{#2}\bigskip + \stopelement{Span}\nobreak} + +\testfont timesr timesr +\testfont timesi timesi +\testfont timesrb timesrb +\testfont timesib timesib +\testfont timesr timesg +\testfont timesr cyrillic + +\testfont gothiceng gothiceng +\testfont gothicger gothicger +\testfont gothicita gothicita + +\testfont rowmans rowmans +\testfont rowmand rowmand +\testfont rowmant rowmant + +\testfont futural futural +\testfont futuram futuram + +\testfont timesr greeks +\testfont timesr greekc + +\testfont scripts scripts +\testfont scriptc scriptc + +\testfont timesr mathlow +\testfont timesr mathupp + +\testfont astrology astrology +\testfont meteorology meteorology +\testfont timesr symbolic +\testfont timesr markers +\testfont music music + +\vfil\break\end + diff --git a/graphics/pgf/contrib/tikz-ext/README.md b/graphics/pgf/contrib/tikz-ext/README.md index 76ea094357..33ec46d366 100644 --- a/graphics/pgf/contrib/tikz-ext/README.md +++ b/graphics/pgf/contrib/tikz-ext/README.md @@ -31,7 +31,6 @@ These are * `ext.shapes.heatmark` * `ext.shapes.rectangleroundedcorners` * `ext.shapes.superellipse` - * `ext.shapes.uncenteredrectangle` These were developed in response to questions on tex.stackexchange.com. Some of these can be find by searching for my [user id](https://tex.stackexchange.com/search?q=user%3A16595+%22my+library%22). \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-scalepicture.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-scalepicture.tex new file mode 100644 index 0000000000..b14c4c4f0f --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-scalepicture.tex @@ -0,0 +1,113 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\clearpage +\section{Scaling Pictures to a Specific Size} +\label{library:scalepicture} + +\begin{tikzlibrary}{ext.scalepicture} + This library scales \tikzname\ pictures to a specific width or height + by scaling the whole picture. +\end{tikzlibrary} + +\begin{multicols}{2} +If one of the keys below are used on a \tikzname\ picture, i.\,e. +as an option to |\tikzpicture| or \texttt{\textbackslash begin\{tikzpicture\}} +the size of the picture\footnote{This is the size of the pseudo-node \texttt{current bounding box}.} +will be measured and written to the \filetype{aux} file +so that it will be available at the next compilation run +and an appropriate scaling for the picture can be installed. + +\begin{command}{\tikzextpicturewidth} + Returns the last measured width of the picture. + + This will expand to |0pt| if the picture hasn't been measured before. +\end{command} +\begin{command}{\tikzextpictureheight} + Returns the last measured height of the picture. + + This will expand to |0pt| if the picture hasn't been measured before. +\end{command} + +\begin{stylekey}{/tikz/save picture size} + This key is usually used by the keys provided by this library. + Normally, this is not needed to be explicitly given. +\end{stylekey} +\subsection{Keeping the aspect ratio} +The following \emph{unstarred} keys do not change the aspect ratio of the picture. + +\begin{key}{/tikz/picture width=\meta{dimension}} + Scales the picture so that the width of the picture will be \meta{dimension}. + This will keep the aspect ratio the same. +\end{key} + +\begin{key}{/tikz/minimum picture width=\meta{dimension}} + As above but will not change the size of the picture + if its width is greater than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/maximum picture width=\meta{dimension}} + As above but will not change the size of the picture + if its width is less than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/picture height=\meta{dimension}} + Scales the picture so that the height of the picture will be \meta{dimension}. + This will keep the aspect ratio the same. +\end{key} + +\begin{key}{/tikz/minimum picture height=\meta{dimension}} + As above but will not change the size of the picture + if its height is greater than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/maximum picture height=\meta{dimension}} + As above but will not change the size of the picture + if its height is less than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/minimum picture size=\marg{width}\marg{height}} + Scales the picture so that its height will be at least \meta{width} + and its height will be at least \meta{height}. +\end{key} + +\begin{key}{/tikz/maximum picture size=\marg{width}\marg{height}} + Scales the picture so that its height will be at most \meta{width} + and its height will be at most \meta{height}. +\end{key} + +\subsection{Changing the aspect ratio.} +The following \emph{starred} keys do change the aspect ratio. +\begin{key}{/tikz/picture width*=\meta{dimension}} + Scales the picture so that the width of the picture will be \meta{dimension}. + This will only scale the $x$ axis. +\end{key} + +\begin{key}{/tikz/minimum picture width*=\meta{dimension}} + As above but will not change the size of the picture + if its width is greater than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/maximum picture width*=\meta{dimension}} + As above but will not change the size of the picture + if its width is less than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/picture height*=\meta{dimension}} + Scales the picture so that the height of the picture will be \meta{dimension}. + This will only scale the $y$ axis. +\end{key} + +\begin{key}{/tikz/picture size*=\marg{width}\marg{height}} + Scales the picture so that its width will be \meta{width} + and its height will be \meta{height}. + + This will scale both axes but independent from each other. +\end{key} +\end{multicols} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex index 41e56c390e..bf6620a2be 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex @@ -8,7 +8,7 @@ % 2. under the GNU Free Documentation License. % \newcommand*\tikzextname{Ti\textit kZ-Extensions} -\newcommand*\tikzextversion{0.4.1} +\newcommand*\tikzextversion{0.4.2} \begin{document} {\colorlet{blue}{black}% links shall be black \title{\bfseries The \tikzextname\space Package\\ @@ -71,6 +71,8 @@ These libraries only work with \tikzname. \tikzsetfigurename{patterns.images} \include{tikz-ext-manual-en-library-patterns.images} \tikzsetfigurename{positioning-plus} \include{tikz-ext-manual-en-library-positioning-plus} +\tikzsetfigurename{scalepicture} +\include{tikz-ext-manual-en-library-scalepicture} \tikzsetfigurename{topaths.arcthrough} \include{tikz-ext-manual-en-library-topaths.arcthrough} \tikzsetfigurename{trans} @@ -170,6 +172,11 @@ These libraries (should) work with both \pgfname\space and \tikzname. \section*{Changelog}\addcontentsline{toc}{section}{Changelog} \begin{multicols}{2}\raggedright \noindent +Version 0.4.2 +\begin{itemize} +\item \addTikz{scalepicture} +\item Bugfixes to |shapes.uncenteredrectangle|, |paths.ortho|, |positioning-plus| and |pgfcalender-ext|. +\end{itemize} Version 0.4.1 \begin{itemize} \item Cleaned up directory structure of documentary. diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex index 2ba6defa10..682b83b435 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex @@ -115,6 +115,7 @@ ext.paths.timer, ext.patterns.images, ext.positioning-plus, + ext.scalepicture, ext.shapes.heatmark, ext.shapes.circlearrow, ext.shapes.circlecrosssplit, diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf index 51ba04c7d1..855ee19374 100644 Binary files a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf and b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf differ diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex index 253944ca7d..3070585487 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.tex @@ -19,8 +19,8 @@ %mode=list and make, %mode=list only,export=true,% simply skips EVERY picture -> good for debugging the text. ] - \tikzexternalenable -% \tikzexternaldisable +% \tikzexternalenable + \tikzexternaldisable \tikzifexternalizing{ \pgfkeys{/pdflinks/codeexample links=false} }{} diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgfcalendar-ext.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgfcalendar-ext.code.tex new file mode 100644 index 0000000000..fae3508e15 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgfcalendar-ext.code.tex @@ -0,0 +1,370 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\pgfqkeys{/pgf/calendar}{ + style/.style={#1}, + yesterday/.value required, + yesterday/.code={% + \begingroup + \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax + \advance\pgfutil@tempcnta by -1\relax + \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% + \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% + \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% + \pgfcalendarjulianyeartoweek\pgfutil@tempcnta\pgfcalendarifdateyear\pgfutil@tempcntb + \edef\pgfcalendarifdateweek{\the\pgfutil@tempcntb}% + \pgfcalendar@launch@ifdate{#1}{% + \def\pgf@cal@temp{\pgfcalendarmatchestrue}% + }{% + \let\pgf@cal@temp\pgfutil@empty + }% + \expandafter + \endgroup\pgf@cal@temp + }, + relative/.code 2 args={% + \begingroup + \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax + \advance\pgfutil@tempcnta by #1\relax + \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% + \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% + \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% + \pgfcalendarjulianyeartoweek\pgfutil@tempcnta\pgfcalendarifdateyear\pgfutil@tempcntb + \edef\pgfcalendarifdateweek{\the\pgfutil@tempcntb}% + \pgfcalendar@launch@ifdate{#2}{% + \def\pgf@cal@temp{\pgfcalendarmatchestrue}% + }{% + \let\pgf@cal@temp\pgfutil@empty + }% + \expandafter + \endgroup\pgf@cal@temp + }, + Jan/.code={\ifnum\pgfcalendarifdatemonth=1 \expandafter\pgfcalendarmatchestrue\fi},Jan/.value forbidden, + Feb/.code={\ifnum\pgfcalendarifdatemonth=2 \expandafter\pgfcalendarmatchestrue\fi},Feb/.value forbidden, + Mar/.code={\ifnum\pgfcalendarifdatemonth=3 \expandafter\pgfcalendarmatchestrue\fi},Mar/.value forbidden, + Apr/.code={\ifnum\pgfcalendarifdatemonth=4 \expandafter\pgfcalendarmatchestrue\fi},Apr/.value forbidden, + May/.code={\ifnum\pgfcalendarifdatemonth=5 \expandafter\pgfcalendarmatchestrue\fi},May/.value forbidden, + Jun/.code={\ifnum\pgfcalendarifdatemonth=6 \expandafter\pgfcalendarmatchestrue\fi},Jun/.value forbidden, + Jul/.code={\ifnum\pgfcalendarifdatemonth=7 \expandafter\pgfcalendarmatchestrue\fi},Jul/.value forbidden, + Aug/.code={\ifnum\pgfcalendarifdatemonth=8 \expandafter\pgfcalendarmatchestrue\fi},Aug/.value forbidden, + Sep/.code={\ifnum\pgfcalendarifdatemonth=9 \expandafter\pgfcalendarmatchestrue\fi},Sep/.value forbidden, + Oct/.code={\ifnum\pgfcalendarifdatemonth=10 \expandafter\pgfcalendarmatchestrue\fi},Oct/.value forbidden, + Nov/.code={\ifnum\pgfcalendarifdatemonth=11 \expandafter\pgfcalendarmatchestrue\fi},Nov/.value forbidden, + Dec/.code={\ifnum\pgfcalendarifdatemonth=12 \expandafter\pgfcalendarmatchestrue\fi},Dec/.value forbidden, + % + leap year/.code={% + \pgfutil@tempcnta=#1\relax + \divide\pgfutil@tempcnta4 + \multiply\pgfutil@tempcnta4 + \ifnum\pgfutil@tempcnta=#1\relax + \divide\pgfutil@tempcnta100 + \multiply\pgfutil@tempcnta100 + \ifnum\pgfutil@tempcnta=#1\relax + \divide\pgfutil@tempcnta400 + \multiply\pgfutil@tempcnta400 + \ifnum\pgfutil@tempcnta=#1\relax + \pgfcalendarmatchestrue + \fi + \else + \pgfcalendarmatchestrue + \fi + \fi}, + leap year/.default=\pgfcalendarifdateyear, + between days/.value required, + between days/.code args={#1and#2}{% + \pgfutil@tempcnta=#1\relax + \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta\else + \pgfutil@tempcnta=#2\relax + \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta\else + \pgfcalendarmatchestrue\fi\fi}, + week of month/.code={% + \pgfutil@tempcnta=#1\relax + \multiply\pgfutil@tempcnta7 + \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta\else + \advance\pgfutil@tempcnta-7 + \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta + \pgfcalendarmatchestrue + \fi + \fi}, + week of month'/.code={% + \pgfcalendar@getlastYMX\pgfcalendarifdateyear\pgfcalendarifdatemonth\pgfutil@tempcnta + \advance\pgfutil@tempcnta1 + \pgfutil@tempcntb=#1\relax + \multiply\pgfutil@tempcntb7 + \advance\pgfutil@tempcnta-\pgfutil@tempcntb + \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta\else + \advance\pgfutil@tempcnta+7 + \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta + \pgfcalendarmatchestrue + \fi + \fi}, + first/.code={\pgfutil@in@:{#1}\ifpgfutil@in@ + \pgfcalendar@ifdate@first{}#1\pgf@stop\else + \pgfcalendar@ifdate@first{}1:#1\pgf@stop\fi}, + last/.code={\pgfutil@in@:{#1}\ifpgfutil@in@ + \pgfcalendar@ifdate@first'#1\pgf@stop\else + \pgfcalendar@ifdate@first'1:#1\pgf@stop\fi}, + % logic + not/.value required, + not/.code=% + \begingroup + \let\pgf@cal@tempa\pgfutil@empty + \pgfcalendar@launch@ifdate{#1}{}{\def\pgf@cal@tempa{\pgfcalendarmatchestrue}}% + \expandafter\endgroup\pgf@cal@tempa, + and/.value required, + and/.code=% and = {, , , …} + \begingroup + \pgfcalendarmatchestrue + \pgfqkeys{/pgf/calendar/and}{#1}% + \ifpgfcalendarmatches % is it still true? + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\def\pgf@cal@temp{\pgfcalendarmatchestrue}}% + {\let\pgf@cal@temp\pgfutil@empty}% + \expandafter\endgroup\pgf@cal@temp, + and/.unknown/.code=% only inside the group of and/.code + \ifpgfcalendarmatches + \expandafter\pgfutil@firstofone + \else + \expandafter\pgfutil@gobble + \fi + {% + \begingroup + \pgfcalendar@launch@ifdate{\pgfkeyscurrentname={#1}}% + {\let\pgf@cal@temp\pgfutil@empty}{\def\pgf@cal@temp{\pgfcalendarmatchesfalse}} + \expandafter\endgroup\pgf@cal@temp + },% + calendar week of month/.default=1, + calendar week of month'/.default=1, + calendar week of month/.code={% + \begingroup + \pgfutil@tempcnta=\pgfcalendarifdateday\relax + \advance\pgfutil@tempcnta by 5 + \advance\pgfutil@tempcnta by -\pgfcalendarifdateweekday\relax + \divide\pgfutil@tempcnta by 7 + \advance\pgfutil@tempcnta by -#1\relax + \expandafter\endgroup\expandafter + \ifnum\the\pgfutil@tempcnta=-1 + \pgfcalendarmatchestrue + \fi}, + calendar week of month'/.code={% + \begingroup + \pgfcalendar@getlastYMX\pgfcalendarifdateyear\pgfcalendarifdatemonth\pgfutil@tempcnta + \advance\pgfutil@tempcnta by -\pgfcalendarifdateday\relax + \edef\pgfcalendarifdateday{\the\pgfutil@tempcnta}% + \pgfutil@tempcnta=-\pgfcalendarifdateweekday\relax + \advance\pgfutil@tempcnta by 5 + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcnta}% + \let\pgf@cal@temp\pgfutil@empty + \pgfcalendar@launch@ifdate{calendar week of month={#1}}{\def\pgf@cal@temp{\pgfcalendarmatchestrue}}{}% + \expandafter\endgroup\pgf@cal@temp}} + +\def\pgfcalendar@ifdate@first#1#2:#3\pgf@stop{% + \pgfqkeys{/pgf/calendar}{and={#3, week of month#1={#2}}}} +\def\pgfcalendar@getlastYMX#1#2#3{% #1 = year, #2 = month, #3 := last day + \begingroup + \ifnum#2=2 % stupid February + \pgfcalendarmatchesfalse + \pgfqkeys{/pgf/calendar}{leap year={#1}}% + \ifpgfcalendarmatches + #3=29 + \else + #3=28 + \fi + \else + #3=\ifcase#2\relax\or + 31\or\or31\or30\or31\or30\or31\or31\or30\or31\or30\or31\fi + \fi + \edef\pgf@cal@temp{#3=\the#3\relax} + \expandafter + \endgroup\pgf@cal@temp} + +% +% weeks +% +\def\pgfcalendar@week@setup#1{% + \pgfutil@IfUndefined{pgfcalendar@week@#1}{% + \begingroup + \pgfcalendardatetojulian{#1-01-01}\pgfutil@tempcnta + \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb + % + % tempcnta holds the julian number for first day of the current year + % tempcntb holds the weekday for the first day of the current year + % + % set tempcnta to the Monday of the week with first day of current year + \advance\pgfutil@tempcnta by -\pgfutil@tempcntb + % + % if the first week starts at Fri, Sat or Sun, next week is the 1st week + \ifnum\pgfutil@tempcntb>3\relax + \advance\pgfutil@tempcnta by 7\relax + \fi + % setup macro for year with {Julian number for day of first week}{weekday of -01-01} + \expandafter\xdef\csname pgfcalendar@week@#1\endcsname{{\the\pgfutil@tempcnta}{\the\pgfutil@tempcntb}}% + \endgroup + }{}% +} + +\def\pgfcalendarjulianyeartoweek#1#2#3{\pgfcalendarjulianyeartoweek@{#1}{#2}{#3}{\iftrue}} +\def\pgfcalendarjulianyeartoweek@#1#2#3#4{% + % #1 = julian date (count) + % #2 = year + % #3 = count that holds the week at the end + % #4 = \iftrue or \iffalse: whether week 53 needs to be checked (\iffalse when determing week from next year) + \begingroup + \pgfcalendar@week@setup{#2}% + #3=#1\relax + % + % calculate difference of days between current date and start of week 1 + % + \advance#3 by -\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgfcalendar@week@#2\endcsname\relax + \ifnum#3<0\relax % whoops, we are in the week of the previous year + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {% if first day of the year is Fri, Sat or Sun + \ifnum\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname pgfcalendar@week@#2\endcsname>3\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {% we need to check the week of the previous year + #3=#2\relax + \advance#3 by -1 + \edef\pgf@cal@temp{\noexpand\pgfcalendarjulianyeartoweek@{#1}{\the#3}{#3}\noexpand\iffalse}% + \pgf@cal@temp + }{% yeah, it's weird + \divide#3 by 7 + \advance#3 by 1 + }% + }{% + \divide#3 by 7 + \advance#3 by 1 + #4% + \expandafter\pgfutil@firstofone + \else + \expandafter\pgfutil@gobble + \fi + {% + \ifnum#3=53\relax % whoops, we are possibly in the first week of the next year + \expandafter\pgfutil@firstofone + \else + \expandafter\pgfutil@gobble + \fi + {% + \begingroup + % check whether we're already in week 1 of the next year + #3=#2\relax + \advance#3 by 1 + \expandafter\pgfcalendar@week@setup\expandafter{\the#3}% + \ifnum#1<\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgfcalendar@week@\the#3\endcsname\relax + #3=53 + \else + #3=1 + \fi + \expandafter + \endgroup\expandafter#3\the#3\relax + }% + }% + }% + \expandafter + \endgroup\expandafter + #3\the#3\relax +} + +% +% shorthands for weeks (n) +% +% n-: shortest +% n=: shortest but prepends whitespace +% n0: leading zero +% +\expandafter\def\csname pgfcalendar@shorthand@n-\endcsname{% + \if0\pgfcalendarcurrentweek\else\pgfcalendarcurrentweek\fi} +\expandafter\def\csname pgfcalendar@shorthand@n=\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentweek\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@n0\endcsname{% + \pgfcalendarcurrentweek} + +% +% Overwriting original \pgfcalendar +% +\long\def\pgfcalendar#1#2#3#4{% + \begingroup% + % Setup local \ifdate + \let\ifdate=\pgfcalendar@local@ifdate% + % Let's start with computing start and end dates... + \def\pgfcalendarprefix{#1}% + \pgfcalendardatetojulian{#2}{\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginjulian{\the\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginiso{#2}% + \pgfcalendardatetojulian{#3}{\pgfutil@tempcnta}% + \edef\pgfcalendarendjulian{\the\pgfutil@tempcnta}% + \advance\pgfutil@tempcnta by1\relax% + \edef\pgfcalendarendjulianplus{\the\pgfutil@tempcnta}% + \edef\pgfcalendarendiso{#3}% + % + % Start main loop + % + \loop% + \ifnum\pgfcalendarcurrentjulian<\pgfcalendarendjulianplus\relax% + % Setup information about current date + \pgfcalendarjuliantodate{\pgfcalendarcurrentjulian}% + {\pgfcalendarcurrentyear}{\pgfcalendarcurrentmonth}{\pgfcalendarcurrentday}% + \pgfcalendarjuliantoweekday{\pgfcalendarcurrentjulian}{\pgfutil@tempcntb}% + \edef\pgfcalendarcurrentweekday{\the\pgfutil@tempcntb}% + \pgfcalendarjulianyeartoweek{\pgfcalendarcurrentjulian}{\pgfcalendarcurrentyear}{\pgfutil@tempcntb}% + \edef\pgfcalendarcurrentweek{\ifnum\pgfutil@tempcntb<10 0\fi\the\pgfutil@tempcntb}% + % Render: + #4% + % Advance day: + \advance\pgfcalendarcurrentjulian by1\relax% + \repeat% + \endgroup% +} + +% +% Overwriting original \pgfcalendar@local@ifdate +% +\def\pgfcalendar@local@ifdate{% + \let\pgfcalendarifdatejulian=\pgfcalendarcurrentjulian + \let\pgfcalendarifdateyear=\pgfcalendarcurrentyear + \let\pgfcalendarifdatemonth=\pgfcalendarcurrentmonth + \let\pgfcalendarifdateday=\pgfcalendarcurrentday + \let\pgfcalendarifdateweekday=\pgfcalendarcurrentweekday + \let\pgfcalendarifdateweek=\pgfcalendarcurrentweek + \pgfcalendar@launch@ifdate% +} +% +% Overwritigin original \pgfcalendarifdate +% +\def\pgfcalendarifdate#1#2#3#4{% + \pgfcalendardatetojulian{#1}{\pgfutil@tempcnta}% + \pgfcalendarjuliantodate{\pgfutil@tempcnta} + {\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% + \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% + % Compute info about date + \pgfcalendarjuliantoweekday{\pgfutil@tempcnta}{\pgfutil@tempcntb}% + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% + \pgfcalendarjulianyeartoweek{\pgfcalendarifdatejulian}{\pgfcalendarifdateyear}{\pgfutil@tempcntb}% + \edef\pgfcalendarifdateweek{\ifnum\pgfutil@tempcntb<10 0\fi\the\pgfutil@tempcntb}% + % + \pgfcalendar@launch@ifdate{#2}{#3}{#4}% +} + +\pgfqkeys{/pgf/calendar/week}{.value required,.code={\ifnum#1=\pgfcalendarifdateweek\relax\expandafter\pgfcalendarmatchestrue\fi}} + +% Overwriting shorthands of pgfcalendar +\expandafter\def\csname pgfcalendar@shorthand@d-\endcsname{% + \if0\pgfcalendarcurrentday\else\pgfcalendarcurrentday\fi} +\expandafter\def\csname pgfcalendar@shorthand@m-\endcsname{% + \if0\pgfcalendarcurrentmonth\else\pgfcalendarcurrentmonth\fi} + +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex new file mode 100644 index 0000000000..49aedb64c6 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex @@ -0,0 +1,139 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\input pgfmath.tex + +%% Handlers +%% .pgfmath evaluates values given to keys in PGFmath before handing them over. +%% .pgfmath int truncates the result +%% .pgfmath strcat concatenates the given values +\pgfqkeys{/handlers}{ + .pgfmath/.code=% + \begingroup + \pgfmathparse{#1}% + \expandafter\endgroup\expandafter + \pgfkeys@exp@call\expandafter{\pgfmathresult}, + .pgfmath int/.code=% + \begingroup + \pgfmathint{#1}% + \expandafter\endgroup\expandafter + \pgfkeys@exp@call\expandafter{\pgfmathresult}, + .pgfmath wrap/.code 2 args={% + \def\pgfkeys@temp##1{\def\pgfkeys@temp{#1}}% + \begingroup + \pgfmathparse{#2}% + \expandafter\pgfkeys@temp\expandafter{\pgfmathresult}% + \expandafter\endgroup\expandafter + \pgfkeys@exp@call\expandafter{\pgfkeys@temp}% + }, + .pgfmath if/.code n args={3}{% + \begingroup + \pgfmathifthenelse{#1}{"1"}{"0"}% + \expandafter\endgroup\expandafter + \ifcase\pgfmathresult\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeys@exp@call{#3}}% + {\pgfkeys@exp@call{#2}}% + }, + .if/.code n args={4}{% + \if#1#2% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeys@exp@call{#3}}% + {\pgfkeys@exp@call{#4}}% + }, + .ifnum/.code n args={3}{% + \ifnum#1\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeys@exp@call{#2}}% + {\pgfkeys@exp@call{#3}}% + }, + .ifdim/.code n args={3}{% + \ifdim#1\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeys@exp@call{#2}}% + {\pgfkeys@exp@call{#3}}% + }, + .ifx/.code n args={4}{% + \ifx#1#2% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeys@exp@call{#3}}% + {\pgfkeys@exp@call{#4}}% + }, + .ifxempty/.code n args={3}{% + \edef\pgfkeys@temp{#1}% + \pgfutil@ifxempty\pgfkeys@temp{\pgfkeys@exp@call{#2}}{\pgfkeys@exp@call{#3}}% + }, + .ifempty/.code n args={3}{% + \pgfutil@ifempty{#1}{\pgfkeys@exp@call{#2}}{\pgfkeys@exp@call{#3}}% + }, + %% http://tex.stackexchange.com/a/144187/16595 + %% key/.List={(point-1),(point-2),(point-...),(point-6)} will call + %% key=(point-1)(point-2)(point-3)(point-4)(point-5),(point-6) + .List/.code=% + \let\pgfkeys@global@temp\pgfutil@empty + \foreach\pgfkeys@temp in{#1}{% + \expandafter\pgfutil@g@addto@macro\expandafter\pgfkeys@global@temp\expandafter{\pgfkeys@temp}% + }% + \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}% +} + +\pgfqkeys{/utils}{ + if/.code n args={3}{% + \begingroup + \pgfmathifthenelse{#1}{"1"}{"0"}% + \expandafter\endgroup\expandafter + \ifcase\pgfmathresult\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {\pgfkeysalso{#3}} + {\pgfkeysalso{#2}}% + }, + TeX/if/.code n args={4}{% + \if#1#2\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% + }, + TeX/ifnum/.code n args={3}{% + \ifnum#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifdim/.code n args={3}{% + \ifdim#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifx/.code n args={4}{% + \ifx#1#2\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi + {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% + }, + TeX/ifxempty/.code n args={3}{% + \edef\pgfkeys@temp{#1}% + \pgfutil@ifxempty\pgfkeys@temp{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + TeX/ifempty/.code n args={3}{% + \pgfutil@ifempty{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + tex/.search also=/utils/TeX, +} + +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex new file mode 100644 index 0000000000..6101ca8cad --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex @@ -0,0 +1,11 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\input pgfkeyslibraryext.pgfkeys-plus.code.tex + +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlearrow.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlearrow.code.tex new file mode 100644 index 0000000000..9eb1c6ab09 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlearrow.code.tex @@ -0,0 +1,66 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\pgfset{ + circle arrow start angle/.initial=, + circle arrow end angle/.initial=, + circle arrow delta angle/.initial=, + circle arrow arrows/.initial=-, + circle arrow/@turn left/.style={/pgf/circle arrow arrows=->,/pgf/circle arrow delta angle=340}, + circle arrow/@turn right/.style={/pgf/circle arrow arrows=<-,/pgf/circle arrow delta angle=340}, + circle arrow turn left north/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=100}, + circle arrow turn left east/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=10}, + circle arrow turn left south/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=280}, + circle arrow turn left west/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=190}, + circle arrow turn right north/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=100}, + circle arrow turn right east/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=10}, + circle arrow turn right south/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=280}, + circle arrow turn right west/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=190}, +} +\pgfdeclareshape{circle arrow}{ + \inheritsavedanchors[from=circle] + \inheritanchorborder[from=circle] + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{south east} + \backgroundpath{ + \pgfkeysgetvalue{/pgf/circle arrow start angle}\pgf@sh@circlearrow@s + \pgfkeysgetvalue{/pgf/circle arrow end angle}\pgf@sh@circlearrow@e + \pgfkeysgetvalue{/pgf/circle arrow delta angle}\pgf@sh@circlearrow@d + \ifx\pgf@sh@circlearrow@s\pgfutil@empty% + \pgfmathsetmacro\pgf@sh@circlearrow@s{\pgf@sh@circlearrow@e-\pgf@sh@circlearrow@d}% + \else + \ifx\pgf@sh@circlearrow@e\pgfutil@empty% + \pgfmathsetmacro\pgf@sh@circlearrow@e{\pgf@sh@circlearrow@s+\pgf@sh@circlearrow@d}% + \fi% + \fi + \pgfutil@tempdima=\radius + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb + \advance\pgfutil@tempdima by-\pgf@yb + \else + \advance\pgfutil@tempdima by-\pgf@xb + \fi + \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfpointpolar{\pgf@sh@circlearrow@s}{\pgfutil@tempdima}}}% + \pgfpatharc{\pgf@sh@circlearrow@s}{\pgf@sh@circlearrow@e}{\pgfutil@tempdima}% + \pgfkeysgetvalue{/pgf/circle arrow arrows}\pgf@temp + \expandafter\pgfsetarrows\expandafter{\pgf@temp}% + } +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlecrosssplit.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlecrosssplit.code.tex new file mode 100644 index 0000000000..7bc2761fb4 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.circlecrosssplit.code.tex @@ -0,0 +1,292 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\usepgflibrary{shapes.multipart} +\let\pgfnodeparttrbox\pgfnodeparttwobox +\let\pgfnodepartblbox\pgfnodepartthreebox +\let\pgfnodepartbrbox\pgfnodepartfourbox +\newif\ifpgfcirclecrosssplitcustomfill +\pgfset{% + circle cross split part fill/.code=% + \def\pgf@lib@sh@ccs@list@fill{#1}% + \pgfcirclecrosssplitcustomfilltrue,% + circle cross split uses custom fill/.is if=pgfcirclecrosssplitcustomfill +} +\def\pgf@lib@sh@ccs@list@fill{none}% +\pgfdeclareshape{circle cross split}{% + \nodeparts{text,two,three,four}% + \savedanchor\centerpoint{% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \pgf@x =\wd\pgfnodeparttextbox + \pgf@yb=\dp\pgfnodeparttextbox + \pgf@y=\dp\pgfnodeparttwobox + \ifdim\pgf@yb>\pgf@y + \pgf@y=\pgf@yb + \fi + \advance\pgf@x\pgf@xa + \advance\pgf@y-\pgf@ya + \advance\pgf@x.5\pgflinewidth + \advance\pgf@y-.5\pgflinewidth + }% + \savedanchor\twoanchor{% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@x.5\pgflinewidth + \advance\pgf@x\pgf@xa + \advance\pgf@y.5\pgflinewidth + \advance\pgf@y\pgf@ya + \pgf@yb\dp\pgfnodeparttextbox + \pgf@yc\dp\pgfnodeparttwobox + \ifdim\pgf@yb>\pgf@yc + \pgf@yc\pgf@yb + \fi + \advance\pgf@y\pgf@yc + }% + \savedanchor\threeanchor{% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \pgf@x\wd\pgfnodeparttextbox + \pgf@yb\dp\pgfnodeparttextbox + \pgf@yc\dp\pgfnodeparttwobox + \ifdim\pgf@yb>\pgf@yc + \pgf@yc\pgf@yb + \fi + \advance\pgf@y-\pgf@yc + \advance\pgf@y-2\pgf@ya + \advance\pgf@y-\pgflinewidth + \pgf@yb\ht\pgfnodepartthreebox + \pgf@yc\ht\pgfnodepartfourbox + \ifdim\pgf@yb>\pgf@yc + \pgf@yc\pgf@yb + \fi + \advance\pgf@y-\pgf@yc + \advance\pgf@x-\wd\pgfnodepartthreebox + }% + \saveddimen\radius{% + % height (upper): + \pgf@y=\ht\pgfnodeparttextbox + \ifdim\pgf@y<\ht\pgfnodeparttwobox + \pgf@y=\ht\pgfnodeparttwobox + \fi + \ifdim\dp\pgfnodeparttextbox>\dp\pgfnodeparttwobox + \advance\pgf@y by\dp\pgfnodeparttextbox + \else + \advance\pgf@y by\dp\pgfnodeparttwobox + \fi + % height (lower): + \pgf@yb\ht\pgfnodepartthreebox + \ifdim\pgf@yb<\ht\pgfnodepartfourbox + \pgf@yb=\ht\pgfnodepartfourbox + \fi + \pgf@yc=\dp\pgfnodepartthreebox + \ifdim\pgf@yc<\dp\pgfnodepartfourbox + \advance\pgf@yb by\dp\pgfnodepartfourbox + \else + \advance\pgf@yb by\pgf@yc + \fi + \ifdim\pgf@yc>\pgf@y + \pgf@y=\pgf@yc + \fi + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y2\pgf@ya + % + \pgf@x\wd\pgfnodeparttextbox + \pgf@xa\wd\pgfnodepartthreebox + \pgf@xb\wd\pgfnodeparttwobox + \pgf@xc\wd\pgfnodepartfourbox + \ifdim\pgf@xa>\pgf@x + \pgf@x\pgf@xa + \fi + \ifdim\pgf@xb>\pgf@x + \pgf@x\pgf@xb + \fi + \ifdim\pgf@xc>\pgf@x + \pgf@x\pgf@xc + \fi + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x by 2\pgf@xa + \ifdim\pgf@y>\pgf@x + \pgf@x=\pgf@y + \fi + \advance\pgf@x by\pgflinewidth + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + % from circle: + \pgf@process{\pgfpointnormalised{}}% + \ifdim\pgf@x>\pgf@y% + \c@pgf@counta=\pgf@x% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@xa=16\pgf@xa\relax% + \divide\pgf@xa by\c@pgf@counta% + \pgf@xa=16\pgf@xa\relax% + \fi% + \else% + \c@pgf@counta=\pgf@y% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@ya=16\pgf@ya\relax% + \divide\pgf@ya by\c@pgf@counta% + \pgf@xa=16\pgf@ya\relax% + \fi% + \fi% + \pgf@x=\pgf@xa% + % + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xb + \pgf@x=.5\pgf@xb + \fi + \ifdim\pgf@x<.5\pgf@yb + \pgf@x=.5\pgf@yb + \fi + % + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb + \advance\pgf@x\pgf@yb + \else + \advance\pgf@x\pgf@xb + \fi + }% + \inheritanchorborder[from=circle]% + \inheritanchor[from=circle]{north}% + \inheritanchor[from=circle]{north west}% + \inheritanchor[from=circle]{north east}% + \inheritanchor[from=circle]{center}% + \inheritanchor[from=circle]{west}% + \inheritanchor[from=circle]{east}% + \inheritanchor[from=circle]{mid}% + \inheritanchor[from=circle]{mid west}% + \inheritanchor[from=circle]{mid east}% + \inheritanchor[from=circle]{base}% + \inheritanchor[from=circle]{base west}% + \inheritanchor[from=circle]{base east}% + \inheritanchor[from=circle]{south}% + \inheritanchor[from=circle]{south west}% + \inheritanchor[from=circle]{south east}% + \anchor{two}{\twoanchor}% + \anchor{three}{\threeanchor}% + \anchor{four}{ + \threeanchor + \pgf@ya=\pgf@y + \twoanchor + \pgf@y=\pgf@ya + }% + \anchor{lower base}{% + \threeanchor + \pgf@ya=\pgf@y + \centerpoint + \pgf@y=\pgf@ya + } + \anchor{lower base west}{% + \threeanchor + \pgf@ya=\pgf@y + \centerpoint + \pgf@y=\pgf@ya + \advance\pgf@x by-\radius + } + \anchor{lower base east}{% + \threeanchor + \pgf@ya=\pgf@y + \centerpoint + \pgf@y=\pgf@ya + \advance\pgf@x by\radius + } + \anchor{lower mid}{% + \threeanchor + \pgf@ya=\pgf@y + \centerpoint + \pgf@y=\pgf@ya + \pgfmathsetlength\pgf@ya{+.5ex}% + \advance\pgf@y by\pgf@ya + } + \anchor{lower mid west}{% + \threeanchor + \pgf@ya=\pgf@y + \centerpoint + \pgf@y=\pgf@ya + \advance\pgf@x by-\radius + \pgfmathsetlength\pgf@ya{+.5ex}% + \advance\pgf@y by\pgf@ya + } + \anchor{lower mid east}{% + \threeanchor + \pgf@ya=\pgf@y + \centerpoint + \pgf@y=\pgf@ya + \advance\pgf@x by\radius + \pgfmathsetlength\pgf@ya{+.5ex}% + \advance\pgf@y by\pgf@ya + } + \inheritbackgroundpath[from=circle] + \beforebackgroundpath{% + \pgfutil@tempdima=\radius + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb + \advance\pgfutil@tempdima by-\pgf@yb + \else + \advance\pgfutil@tempdima by-\pgf@xb + \fi + \advance\pgfutil@tempdima by-.5\pgflinewidth% + \pgfsetshortenstart{0pt}% + \pgfsetshortenend{0pt}% + \pgfsetarrows{-}% + \pgfpathmoveto + {\pgfpointadd{\centerpoint}{\pgfqpoint{-\pgfutil@tempdima}{0pt}}}% + \pgfpathlineto + {\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}% + \pgfpathmoveto + {\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-\pgfutil@tempdima}}}% + \pgfpathlineto + {\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\pgfutil@tempdima}}}% + \pgfusepathqstroke + }% + \behindbackgroundpath{% + \pgfutil@tempdima=\radius + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb + \advance\pgfutil@tempdima by-\pgf@yb + \else + \advance\pgfutil@tempdima by-\pgf@xb + \fi + \advance\pgfutil@tempdima by-.5\pgflinewidth% + \ifpgfcirclecrosssplitcustomfill% + \pgf@lib@sh@rs@process@list{\pgf@lib@sh@ccs@list@fill}{4}% + {% + \pgfmathloop + \ifnum\pgfmathcounter>4% + \else% + \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% + \edef\pgf@tempa + {\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}% + \ifx\pgf@tempa\pgf@lib@sh@rs@nonetext\else + \pgfsetfillcolor{\pgf@tempa}% + \ifcase\pgfmathcounter\or + \def\pgf@lib@sh@ccs@angle{90}\or + \def\pgf@lib@sh@ccs@angle{0}\or + \def\pgf@lib@sh@ccs@angle{180}\else + \def\pgf@lib@sh@ccs@angle{270}% + \fi + \pgfpathmoveto{\centerpoint}% + \pgfpathlineto{\pgfpointadd{\centerpoint} + {\pgfqpointpolar{\pgf@lib@sh@ccs@angle}{\pgfutil@tempdima}}}% + \pgfpatharc{+\pgf@lib@sh@ccs@angle}{\pgf@lib@sh@ccs@angle+90} + {+\pgfutil@tempdima}% + \pgfpathclose + \pgfusepathqfill + \fi + \repeatpgfmathloop + }% + \fi + }% +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.heatmark.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.heatmark.code.tex new file mode 100644 index 0000000000..477d0442da --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.heatmark.code.tex @@ -0,0 +1,181 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\pgfset{ + heatmark arc width/.initial=+4pt, + heatmark arc sep/.initial=+1pt, + heatmark arc rings/.initial=3, + heatmark arcs/.initial=3, + heatmark arc sep angle/.initial=20, + heatmark inner opacity/.initial=.8, + heatmark outer opacity/.initial=.2 +} +\pgfdeclareshape{heatmark} +% +% Draws a circle around the text +% +{ + \savedanchor\centerpoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + } + + \saveddimen\innerradius{% + % + % Caculate ``height radius'' + % + \pgf@ya=.5\ht\pgfnodeparttextbox% + \advance\pgf@ya by.5\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya by\pgf@yb% + % + % Caculate ``width radius'' + % + \pgf@xa=.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa by\pgf@xb% + % + % Calculate length of radius vector: + % + \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% + \ifdim\pgf@x>\pgf@y% + \c@pgf@counta=\pgf@x% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@xa=16\pgf@xa\relax% + \divide\pgf@xa by\c@pgf@counta% + \pgf@xa=16\pgf@xa\relax% + \fi% + \else% + \c@pgf@counta=\pgf@y% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@ya=16\pgf@ya\relax% + \divide\pgf@ya by\c@pgf@counta% + \pgf@xa=16\pgf@ya\relax% + \fi% + \fi% + \pgf@x=\pgf@xa% + % + % If necessary, adjust radius so that the size requirements are + % met: + % + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xb% + \pgf@x=.5\pgf@xb% + \fi% + \ifdim\pgf@x<.5\pgf@yb% + \pgf@x=.5\pgf@yb% + \fi% + }% + + \saveddimen\radius{% + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb% + \advance\pgf@x by\pgf@yb% + \else% + \advance\pgf@x by\pgf@xb% + \fi% + \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/heatmark arc rings}}% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/heatmark arc width}+\pgfkeysvalueof{/pgf/heatmark arc sep}}% + \multiply\pgf@xa\c@pgf@counta + \advance\pgf@x\pgf@xa + }% + % + % Anchors + % + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{south east} + \inheritanchorborder[from=circle] + % + % Background path + % + \backgroundpath{ + \pgfutil@tempdima=\innerradius% + \pgfpathcircle{\centerpoint}{\pgfutil@tempdima}% + }% + % + % + % + \behindbackgroundpath{% + \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/heatmark arc rings}}% heat arc rings + \pgfmathsetcount\c@pgf@countb{\pgfkeysvalueof{/pgf/heatmark arcs}}% heat arcs + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/heatmark arc width}}% heat arc width + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/heatmark arc sep}}% heat arc sep + %\pgfmathsetmacro\pgf@tempa{\pgfkeysvalueof{/pgf/heat arc sep angle}}% heat arc sep angle + \pgfmathsetmacro\pgf@tempb{360/\c@pgf@countb-(\pgfkeysvalueof{/pgf/heatmark arc sep angle})}% heat arc + \pgfmathsetmacro\pgf@tempc{\pgfkeysvalueof{/pgf/shape border rotate}}% heat rotate + % + \pgfmathsetmacro\pgf@tempd{\pgfkeysvalueof{/pgf/heatmark inner opacity}}% heat opacity high + \ifnum\c@pgf@counta=1 + \def\tikzext@heatmark@opacity@seps{0}% + \else + \pgfmathsetmacro\tikzext@heatmark@opacity@seps + {(\pgf@tempd-(\pgfkeysvalueof{/pgf/heatmark outer opacity}))% + /(\c@pgf@counta-1)}% + \fi + \pgfutil@tempcnta=0 + \pgfutil@tempcntb=0 + \pgf@ya\innerradius\relax + \pgftransformshift{\centerpoint} + \pgfutil@loop % ring loop + \advance\pgf@ya\pgf@xb % current radius + heat arc sep + \pgf@yb\pgf@ya + \advance\pgf@yb\pgf@xa % current radius + heat arc sep + heat arc width + \pgfsetfillopacity{\pgf@tempd}% + \begingroup + \edef\pgf@marshal{\noexpand\pgfset{heatmark ring \the\numexpr\pgfutil@tempcnta+1\relax/.try}}% + \pgf@marshal + \csname tikz@options\endcsname + {% + \pgfutil@loop + \pgfmathsetmacro\tikzext@heatmark@start@angle{\pgf@tempc-.5*\pgf@tempb+\pgfutil@tempcntb*(360/\c@pgf@countb)}% + % path + \begingroup + \edef\pgf@marshal{\noexpand\pgfset{heatmark arc \the\numexpr\pgfutil@tempcntb+1\relax/.try}% + \noexpand\pgfset{heatmark ring \the\numexpr\pgfutil@tempcnta+1\relax\space arc \the\numexpr\pgfutil@tempcntb+1\relax/.try}}% + \pgf@marshal + \csname tikz@options\endcsname + \pgfpathmoveto{\pgfpointpolar{\tikzext@heatmark@start@angle}{\pgf@ya}}% + \pgfpatharc{\tikzext@heatmark@start@angle}{\tikzext@heatmark@start@angle+\pgf@tempb}{\pgf@ya}% + \pgfpathlineto{\pgfpointpolar{\tikzext@heatmark@start@angle+\pgf@tempb}{\pgf@yb}}% + \pgfpatharc{\tikzext@heatmark@start@angle+\pgf@tempb}{\tikzext@heatmark@start@angle}{\pgf@yb}% + \pgfpathclose + \pgfusepathqfill + \endgroup + \advance\pgfutil@tempcntb\@ne + \ifnum\pgfutil@tempcntb<\c@pgf@countb + \pgfutil@repeat + }% + \endgroup + \advance\pgfutil@tempcnta\@ne + \ifnum\pgfutil@tempcnta<\c@pgf@counta + \pgf@ya\pgf@yb + \pgfmathsetmacro\pgf@tempd{\pgf@tempd-\tikzext@heatmark@opacity@seps}% + \pgfutil@repeat + \pgftransformshift{\pgfqpointscale{-1}{\centerpoint}}% + } +} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.rectangleroundedcorners.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.rectangleroundedcorners.code.tex new file mode 100644 index 0000000000..37baf7abbf --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.rectangleroundedcorners.code.tex @@ -0,0 +1,318 @@ +\pgfset{ + rectangle with rounded corners north west radius/.initial=.5\pgflinewidth, + rectangle with rounded corners north east radius/.initial=.5\pgflinewidth, + rectangle with rounded corners south west radius/.initial=.5\pgflinewidth, + rectangle with rounded corners south east radius/.initial=.5\pgflinewidth, + rectangle with rounded corners radius/.style={ + /pgf/rectangle with rounded corners north west radius={#1}, + /pgf/rectangle with rounded corners north east radius={#1}, + /pgf/rectangle with rounded corners south west radius={#1}, + /pgf/rectangle with rounded corners south east radius={#1}} +}% +\pgfdeclareshape{rectangle with rounded corners}{% + \savedmacro\rectanglewithroundedcornersparameter{% + % + % width = max(text width + 2 * inner xseps, minimum width) + 2 * outer xseps + \pgf@x=\wd\pgfnodeparttextbox + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x by 2\pgf@xc + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<\pgf@xc + \pgf@x=\pgf@xc + \fi + % + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/outer xsep}}% + \edef\outerxsep{\the\pgf@xc}% + \addtosavedmacro\outerxsep + \advance\pgf@x by 2\pgf@xc + \pgf@x=.5\pgf@x + \edef\halfwidth{\the\pgf@x}% + \addtosavedmacro\halfwidth + % + % height = max(text height + text depth + 2 * inner yseps, minimum height) + 2 * outer yseps + \pgf@y=\ht\pgfnodeparttextbox + \advance\pgf@y by \dp\pgfnodeparttextbox + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y by 2\pgf@yc + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<\pgf@yc + \pgf@y=\pgf@yc + \fi + % + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}% + \edef\outerysep{\the\pgf@yc}% + \addtosavedmacro\outerysep + \advance\pgf@y by 2\pgf@yc + \pgf@y=.5\pgf@y + \edef\halfheight{\the\pgf@y}% + \addtosavedmacro\halfheight + % + % \centerpoint + \pgf@x=.5\wd\pgfnodeparttextbox + \pgf@y=.5\ht\pgfnodeparttextbox + \advance\pgf@y by -.5\dp\pgfnodeparttextbox + \pgfextract@process\centerpoint{}% + \addtosavedmacro\centerpoint + % + \pgfmathsetlengthmacro\northwestradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners north west radius}} + \pgfmathsetlengthmacro\northeastradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners north east radius}} + \pgfmathsetlengthmacro\southwestradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners south west radius}} + \pgfmathsetlengthmacro\southeastradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners south east radius}} + \addtosavedmacro\northwestradius + \addtosavedmacro\northeastradius + \addtosavedmacro\southwestradius + \addtosavedmacro\southeastradius + }% + \anchor{center}{% + \rectanglewithroundedcornersparameter + \centerpoint + } + \anchor{west}{% + \rectanglewithroundedcornersparameter + \centerpoint + \advance\pgf@x by -\halfwidth + } + \anchor{east}{% + \rectanglewithroundedcornersparameter + \centerpoint + \advance\pgf@x by \halfwidth + } + \anchor{north}{% + \rectanglewithroundedcornersparameter + \centerpoint + \advance\pgf@y by \halfheight + } + \anchor{south}{% + \rectanglewithroundedcornersparameter + \centerpoint + \advance\pgf@y by -\halfheight + } + \anchor{mid}{% + \rectanglewithroundedcornersparameter + \centerpoint + \pgfmathsetlength\pgf@y{+.5ex}% + } + \anchor{mid west}{% + \csname pgf@anchor@rectangle with rounded corners@west\endcsname + \pgfmathsetlength\pgf@y{+.5ex}% + } + \anchor{mid east}{% + \csname pgf@anchor@rectangle with rounded corners@east\endcsname + \pgfmathsetlength\pgf@y{+.5ex}% + } + \anchor{base}{% + \rectanglewithroundedcornersparameter + \centerpoint + \pgf@y=0pt + } + \anchor{base west}{% + \csname pgf@anchor@rectangle with rounded corners@west\endcsname + \pgf@y=0pt + } + \anchor{base east}{% + \csname pgf@anchor@rectangle with rounded corners@east\endcsname + \pgf@y=0pt + } + \anchor{north west}{% + \csname pgf@anchor@rectangle with rounded corners@north west center\endcsname + \ifdim\northwestradius=0pt + \else + \pgf@process{\pgfpointadd{}{\pgfpointpolar{135}{\northwestradius+\outerxsep and \northwestradius+\outerysep}}}% + \fi + } + \anchor{north west center}{% + \rectanglewithroundedcornersparameter + \pgf@x=-\halfwidth + \pgf@y=\halfheight + \ifdim\northwestradius=0pt + \else + \advance\pgf@x by \outerxsep + \advance\pgf@x by \northwestradius + \advance\pgf@y by -\outerysep + \advance\pgf@y by -\northwestradius + \fi + \pgf@process{\pgfpointadd{}{\centerpoint}}% + } + \anchor{north east}{% + \csname pgf@anchor@rectangle with rounded corners@north east center\endcsname + \ifdim\northeastradius=0pt + \else + \pgf@process{\pgfpointadd{}{\pgfpointpolar{45}{\northeastradius+\outerxsep and \northeastradius+\outerysep}}}% + \fi + } + \anchor{north east center}{% + \rectanglewithroundedcornersparameter + \pgf@x=\halfwidth + \pgf@y=\halfheight + \ifdim\northeastradius=0pt + \else + \advance\pgf@x by -\outerxsep + \advance\pgf@x by -\northeastradius + \advance\pgf@y by -\outerysep + \advance\pgf@y by -\northeastradius + \fi + \pgf@process{\pgfpointadd{}{\centerpoint}}% + } + \anchor{south west}{% + \csname pgf@anchor@rectangle with rounded corners@south west center\endcsname + \ifdim\southwestradius=0pt + \else + \pgf@process{\pgfpointadd{}{\pgfpointpolar{225}{\southwestradius+\outerxsep and \southwestradius+\outerysep}}}% + \fi + } + \anchor{south west center}{% + \rectanglewithroundedcornersparameter + \pgf@x=-\halfwidth + \pgf@y=-\halfheight + \ifdim\southwestradius=0pt + \else + \advance\pgf@x by \outerxsep + \advance\pgf@x by \southwestradius + \advance\pgf@y by \outerysep + \advance\pgf@y by \southwestradius + \fi + \pgf@process{\pgfpointadd{}{\centerpoint}}% + } + \anchor{south east}{% + \csname pgf@anchor@rectangle with rounded corners@south east center\endcsname + \ifdim\southeastradius=0pt + \else + \pgf@process{\pgfpointadd{}{\pgfpointpolar{315}{\southeastradius+\outerxsep and \southeastradius+\outerysep}}}% + \fi + } + \anchor{south east center}{% + \rectanglewithroundedcornersparameter + \pgf@x=\halfwidth + \pgf@y=-\halfheight + \ifdim\southeastradius=0pt + \else + \advance\pgf@x by -\outerxsep + \advance\pgf@x by -\southeastradius + \advance\pgf@y by \outerysep + \advance\pgf@y by \southeastradius + \fi + \pgf@process{\pgfpointadd{}{\centerpoint}}% + } + \anchor{below north west}{% + \csname pgf@anchor@rectangle with rounded corners@north west center\endcsname + \advance\pgf@x by -\northwestradius + \advance\pgf@x by -\outerxsep + } + \anchor{above south west}{% + \csname pgf@anchor@rectangle with rounded corners@south west center\endcsname + \advance\pgf@x by -\southwestradius + \advance\pgf@x by -\outerxsep + } + \anchor{below north east}{% + \csname pgf@anchor@rectangle with rounded corners@north east center\endcsname + \advance\pgf@x by \northeastradius + \advance\pgf@x by \outerxsep + } + \anchor{above south east}{% + \csname pgf@anchor@rectangle with rounded corners@south east center\endcsname + \advance\pgf@x by \southeastradius + \advance\pgf@x by \outerxsep + } + \anchor{right north west}{% + \csname pgf@anchor@rectangle with rounded corners@north west center\endcsname + \advance\pgf@y by \northwestradius + \advance\pgf@y by \outerysep + } + \anchor{right south west}{% + \csname pgf@anchor@rectangle with rounded corners@south west center\endcsname + \advance\pgf@y by -\southwestradius + \advance\pgf@y by -\outerysep + } + \anchor{left north east}{% + \csname pgf@anchor@rectangle with rounded corners@north east center\endcsname + \advance\pgf@y by \northeastradius + \advance\pgf@y by \outerysep + } + \anchor{left south east}{% + \csname pgf@anchor@rectangle with rounded corners@south east center\endcsname + \advance\pgf@y by -\southeastradius + \advance\pgf@y by -\outerysep + } + \backgroundpath{% + \rectanglewithroundedcornersparameter + % + \pgf@xa=\halfwidth + \advance\pgf@xa by -\outerxsep + \edef\HalfWidth{\the\pgf@xa}% + % + \pgf@ya=\halfheight + \advance\pgf@ya by -\outerysep + \edef\HalfHeight{\the\pgf@ya}% + % + \pgftransformshift{\centerpoint}% + % + \pgfpathmoveto{\pgfqpoint{\HalfWidth}{0pt}}% + \pgfpathlineto{\pgfpoint {+\HalfWidth}{\HalfHeight-\northeastradius}}% + \pgfpatharc{0}{90}{\northeastradius}% + \pgfpathlineto{\pgfpoint{-\HalfWidth+\northwestradius}{+\HalfHeight}} + \pgfpatharc{90}{180}{\northwestradius}% + \pgfpathlineto{\pgfpoint{+-\HalfWidth}{-\HalfHeight+\southwestradius}}% + \pgfpatharc{180}{270}{\southwestradius}% + \pgfpathlineto{\pgfpoint{\HalfWidth-\southeastradius}{+-\HalfHeight}}% + \pgfpatharc{270}{360}{\southeastradius}% + \pgfpathclose + \pgftransformshift{\pgfqpointscale{-1}{\centerpoint}}% + }% + \anchorborder{% + \pgfextract@process\externalpoint{}% + \ifdim\pgf@x=0pt + \ifdim\pgf@y<0pt + \csname pgf@anchor@rectangle with rounded corners@south\endcsname + \else + \csname pgf@anchor@rectangle with rounded corners@north\endcsname + \fi + \else + \ifdim\pgf@y=0pt + \ifdim\pgf@x<0pt + \csname pgf@anchor@rectangle with rounded corners@west\endcsname + \else + \csname pgf@anchor@rectangle with rounded corners@east\endcsname + \fi + \else + \rectanglewithroundedcornersparameter + \pgfmathanglebetweenpoints{\pgfpointorigin}{\externalpoint}% + \let\angle\pgfmathresult + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextract@process\externalPoint{\pgfpointadd{}{\centerpoint}}% + \ifdim\pgf@xa<0pt + \ifdim\pgf@ya<0pt + % south west + \pgf@sh@rwrc@anchorborder{above south west}{right south west}{south west}{180}{270}{\southwestradius}% + \else + % north west + \pgf@sh@rwrc@anchorborder{right north west}{below north west}{north west}{90}{180}{\northwestradius}% + \fi + \else + \ifdim\pgf@ya<0pt + % south east + \pgf@sh@rwrc@anchorborder{left south east}{above south east}{south east}{270}{360}{\southeastradius}% + \else + % north east + \pgf@sh@rwrc@anchorborder{below north east}{left north east}{north east}{0}{90}{\northeastradius}% + \fi + \fi + \fi + \fi + } +} +\def\pgf@sh@rwrc@anchorborder#1#2#3#4#5#6{% + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rectangle with rounded corners@#1\endcsname}% + \let\angleA\pgfmathresult + \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rectangle with rounded corners@#2\endcsname}% + \let\angleB\pgfmathresult + \if\ifdim\angle pt>\angleA pt 0\else1\fi\ifdim\angle pt<\angleB pt 0\else 2\fi + \pgfmathpointintersectionoflineandarc{\externalPoint}{\centerpoint} + {\csname pgf@anchor@rectangle with rounded corners@#3 center\endcsname} + {#4}{#5}{#6+\outerxsep and #6+\outerysep}% + \else + \pgf@process{\pgfpointadd{\pgfpointborderrectangle{\externalpoint}{\pgfqpoint{\halfwidth}{\halfheight}}}{\centerpoint}}% + \fi +} + +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.superellipse.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.superellipse.code.tex new file mode 100644 index 0000000000..9a89b5a8a6 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.superellipse.code.tex @@ -0,0 +1,198 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\usepgflibrary{shapes.geometric,intersections} +\pgfset{ + superellipse x exponent/.initial=2.5, + superellipse y exponent/.initial=2.5, + superellipse step/.initial=4, + superellipse exponent/.style={/pgf/superellipse x exponent={#1},/pgf/superellipse y exponent={#1}}} + +% Evaluates the x-value of a superellipse around the center +% #1 = t (0≤t≤90) +% #2 = 2/m (x-exp) +% #3 = a (x-rad) +\pgfmathdeclarefunction{superellipsex}{3}{% + \pgfmathcos@{#1}% + \pgfmathpow@{\pgfmathresult}{#2}% + \pgfmathmultiply@{\pgfmathresult}{#3}} + +% Evaluates the y-value of a superellipse around the center +% #1 = t (0≤t≤90) +% #2 = 2/n (y-exp) +% #3 = a (y-rad) +\pgfmathdeclarefunction{superellipsey}{3}{% + \pgfmathsin@{#1}% + \pgfmathpow@{\pgfmathresult}{#2}% + \pgfmathmultiply@{\pgfmathresult}{#3}} + +% Evaluates the x- and y- value of superellipse around the center +% #1 = t (0≤t≤90) +% #2 = 2/m (x-exp) +% #3 = 2/n (y-exp) +% #4 = a (x-rad) +% #5 = b (y-rad) +\def\pgfmathsuperellipseXY#1#2#3#4#5{% + \begingroup + \pgfmathsuperellipsex@{#1}{#2}{#4}% + \let\pgfmath@temp\pgfmathresult + \pgfmathsuperellipsey@{#1}{#3}{#5}% + \edef\pgfmath@temp{\def\noexpand\pgfmathresultX{\pgfmath@temp}% + \def\noexpand\pgfmathresultY{\pgfmathresult}}% + \expandafter + \endgroup\pgfmath@temp} + +\pgfdeclareshape{superellipse}{% + \inheritsavedanchors[from=ellipse] + \inheritanchor[from=ellipse]{text}\inheritanchor[from=ellipse]{center} + \inheritanchor[from=ellipse]{mid}\inheritanchor[from=ellipse]{base} + \inheritanchor[from=ellipse]{north}\inheritanchor[from=ellipse]{south} + \inheritanchor[from=ellipse]{west}\inheritanchor[from=ellipse]{east} + \inheritanchor[from=ellipse]{mid west}\inheritanchor[from=ellipse]{base west} + \inheritanchor[from=ellipse]{mid east}\inheritanchor[from=ellipse]{base east} + \anchor{north east}{% + \pgf@process{\radius}% + \pgfmathpow@{.70710678118}{\xexponent}% + \pgf@x=\pgfmathresult\pgf@x + \pgfmathpow@{.70710678118}{\yexponent}% + \pgf@y=\pgfmathresult\pgf@y + \pgfpointadd{}{\centerpoint}% + } + \anchor{north west}{% + \pgf@process{\radius}% + \pgfmathpow@{.70710678118}{\xexponent}% + \pgf@x=-\pgfmathresult\pgf@x + \pgfmathpow@{.70710678118}{\yexponent}% + \pgf@y=\pgfmathresult\pgf@y + \pgfpointadd{}{\centerpoint}% + } + \anchor{south west}{% + \pgf@process{\radius}% + \pgfmathpow@{.70710678118}{\xexponent}% + \pgf@x=-\pgfmathresult\pgf@x + \pgfmathpow@{.70710678118}{\yexponent}% + \pgf@y=-\pgfmathresult\pgf@y + \pgfpointadd{}{\centerpoint}% + } + \anchor{south east}{% + \pgf@process{\radius}% + \pgfmathpow@{.70710678118}{\xexponent}% + \pgf@x=\pgfmathresult\pgf@x + \pgfmathpow@{.70710678118}{\yexponent}% + \pgf@y=-\pgfmathresult\pgf@y + \pgfpointadd{}{\centerpoint}% + } + \savedmacro\xexponent{% + \pgfmathreciprocal{\pgfkeysvalueof{/pgf/superellipse x exponent}}% + \pgfmathmultiply@{\pgfmathresult}{2}% + \let\xexponent\pgfmathresult + } + \savedmacro\yexponent{% + \pgfmathreciprocal{\pgfkeysvalueof{/pgf/superellipse y exponent}}% + \pgfmathmultiply@{\pgfmathresult}{2}% + \let\yexponent\pgfmathresult + } + \savedmacro\step{% + \pgfmathtruncatemacro\step{\pgfkeysvalueof{/pgf/superellipse step}}% + } + \backgroundpath{% + \pgf@process{\radius}% + \pgfmathsetmacro\xradius{\pgf@x-(\pgfkeysvalueof{/pgf/outer xsep})}% + \pgfmathsetmacro\yradius{\pgf@y-(\pgfkeysvalueof{/pgf/outer ysep})}% + \let\pgf@tempa\pgfutil@empty\let\pgf@tempb\pgfutil@empty + \let\pgf@tempc\pgfutil@empty\let\pgf@tempd\pgfutil@empty + \c@pgf@counta=\step + \pgfutil@loop + \ifnum\c@pgf@counta<90 + \pgfmathsuperellipseXY{\the\c@pgf@counta}{\xexponent}{\yexponent}{\xradius}{\yradius}% + \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{\pgfmathresultX pt}{\pgfmathresultY pt}}}% + \pgfutil@append@macrotomacro\pgf@tempa\pgf@temp + \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{-\pgfmathresultX pt}{\pgfmathresultY pt}}}% + \pgfutil@prefix@macrotomacro\pgf@tempb\pgf@temp + \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{-\pgfmathresultX pt}{-\pgfmathresultY pt}}}% + \pgfutil@append@macrotomacro\pgf@tempc\pgf@temp + \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{\pgfmathresultX pt}{-\pgfmathresultY pt}}}% + \pgfutil@prefix@macrotomacro\pgf@tempd\pgf@temp + \advance\c@pgf@counta by\step + \pgfutil@repeat + \pgftransformshift{\centerpoint}% + \pgfplothandlerclosedcurve + \pgfplotstreamstart + \pgfplotstreampoint{\pgfqpoint{\xradius pt}{0pt}}% east + \pgf@tempa + \pgfplotstreampoint{\pgfqpoint{0pt}{\yradius pt}}% north + \pgf@tempb + \pgfplotstreampoint{\pgfqpoint{-\xradius pt}{0pt}}% west + \pgf@tempc + \pgfplotstreampoint{\pgfqpoint{0pt}{-\yradius pt}}% south + \pgf@tempd + \pgfplotstreamend + \pgftransformshift{\centerpoint\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + } + \anchorborder{% + \pgfextract@process\externalpoint{}% + \ifdim\pgf@x=0pt % catch special case x = 0 + \ifdim\pgf@y<0pt \pgf@anchor@superellipse@south\else\pgf@anchor@superellipse@north\fi + \else + \ifdim\pgf@y=0pt % catch special case y = 0 + \ifdim\pgf@x<0pt \pgf@anchor@superellipse@west\else\pgf@anchor@superellipse@east\fi + \else % both are not zero + % save original direction + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + % make both positive, we're not looking at one quadrant + \ifdim\pgf@xa<0pt \pgf@x=-\pgf@x\fi + \ifdim\pgf@ya<0pt \pgf@y=-\pgf@y\fi + % save that point again + \pgfextract@process\externalpoint{}% + % we need to do the calculations without any transformations + % since we're using plots and \pgfpointborderrectangle + \pgftransformreset + \pgfintersectionofpaths{% + % from center to point on rectangle that encompasses superellipse + \pgf@relevantforpicturesizefalse + \pgfpathmoveto{\pgfpointorigin}% + \pgfpathlineto{\pgfpointborderrectangle{\externalpoint}{\radius}}% + }{% + \pgf@relevantforpicturesizefalse + \pgf@process{\radius} + \edef\xradius{\pgf@sys@tonumber\pgf@x}% + \edef\yradius{\pgf@sys@tonumber\pgf@y}% + \let\pgf@tempa\pgfutil@empty + \c@pgf@counta=\step + \pgfutil@loop + \ifnum\c@pgf@counta<90 + \pgfmathsuperellipseXY{\the\c@pgf@counta}{\xexponent}{\yexponent}{\xradius}{\yradius}% + \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{\pgfmathresultX pt}{\pgfmathresultY pt}}}% + \pgfutil@append@macrotomacro\pgf@tempa\pgf@temp + \advance\c@pgf@counta by\step + \pgfutil@repeat + % we're only using curveto since closedcurve + % messes with our other path + \pgfplothandlercurveto + \pgfplotstreamstart + \pgfplotstreampoint{\pgfqpoint{\xradius pt}{0pt}}% east + \pgf@tempa + \pgfplotstreampoint{\pgfqpoint{0pt}{\yradius pt}}% north + \pgfplotstreamend + }% + \ifnum\pgfintersectionsolutions>0 % only if a solution was found + \pgf@process{\pgfpointintersectionsolution{1}}% + \else % otherwise take the border on the rectangle (close enough?) + \pgf@process{\pgfpointborderrectangle{\externalpoint}{\radius}}% + \fi + \ifdim\pgf@xa<0pt \pgf@x=-\pgf@x\fi + \ifdim\pgf@ya<0pt \pgf@y=-\pgf@y\fi + \pgf@process{\pgfpointadd{}{\centerpoint}}% + \fi + \fi + } +} +\def\pgfutil@prefix@macrotomacro#1#2{% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% + #1\expandafter\expandafter\expandafter{\expandafter#2#1}} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.uncenteredrectangle.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.uncenteredrectangle.code.tex new file mode 100644 index 0000000000..182ebbbcb7 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.shapes.uncenteredrectangle.code.tex @@ -0,0 +1,307 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\pgfutil@IfUndefined{pgfnodepartthreebox}{% + \csname newbox\endcsname\pgfnodepartleftbox + \csname newbox\endcsname\pgfnodepartrightbox +}{% + \let\pgfnodepartleftbox\pgfnodeparttwobox + \let\pgfnodepartrightbox\pgfnodepartthreebox +} +\pgfset{ + uncentered rectangle center yshift/.initial=, + uncentered rectangle center/@center/.initial=2, + uncentered rectangle center/.is choice, + uncentered rectangle center/real/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{0}, + uncentered rectangle center/left/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{1}, + uncentered rectangle center/text/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{2}, + uncentered rectangle center/right/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{3}} + +\pgfdeclareshape{uncentered rectangle}{% + \nodeparts{text,left,right}% + \savedanchor\middleCenter{% + \pgf@x=.5\wd\pgfnodeparttextbox + % + \pgf@y=\dp\pgfnodeparttextbox + \ifdim\dp\pgfnodepartleftbox>\pgf@y + \pgf@y=\dp\pgfnodepartleftbox + \fi + \ifdim\dp\pgfnodepartrightbox>\pgf@y + \pgf@y=\dp\pgfnodepartrightbox + \fi + % + \pgf@ya=\ht\pgfnodeparttextbox + \ifdim\ht\pgfnodepartleftbox>\pgf@ya + \pgf@ya=\ht\pgfnodepartleftbox + \fi + \ifdim\ht\pgfnodepartrightbox>\pgf@ya + \pgf@ya=\ht\pgfnodepartrightbox + \fi + \advance\pgf@ya by -\pgf@y + \pgf@y=.5\pgf@ya + }% + \savedanchor\leftCenter{% + % y should be still the same as before + \pgf@x=-.5\wd\pgfnodepartleftbox + }% + \savedanchor\rightCenter{% + % y should be still the same as before + \pgf@x=.5\wd\pgfnodepartrightbox + \advance\pgf@x by \wd\pgfnodeparttextbox + }% + \savedanchor\realCenter{% + % y should be still the same as before + \pgf@x=-.5\wd\pgfnodepartleftbox + \advance\pgf@x by .5\wd\pgfnodeparttextbox + \advance\pgf@x by .5\wd\pgfnodepartrightbox + }% + \savedanchor\southwest{% + % total width + \pgf@xa=\wd\pgfnodepartleftbox + \advance\pgf@xa by\wd\pgfnodepartrightbox + \advance\pgf@xa by\wd\pgfnodeparttextbox + % + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa by 2\pgf@xc + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@xb>\pgf@xa + \pgf@xa=\pgf@xb + \fi + % left side of shape + \advance\pgf@x by -.5\pgf@xa + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \advance\pgf@x by -\pgf@xa + % + % total height + \pgf@ya=\dp\pgfnodepartleftbox + \ifdim\pgf@ya<\dp\pgfnodeparttextbox + \pgf@ya=\dp\pgfnodeparttextbox + \fi + \ifdim\pgf@ya<\dp\pgfnodepartrightbox + \pgf@ya=\dp\pgfnodepartrightbox + \fi + \pgf@yb=\ht\pgfnodepartleftbox + \ifdim\pgf@yb<\ht\pgfnodeparttextbox + \pgf@yb=\ht\pgfnodeparttextbox + \fi + \ifdim\pgf@yb<\ht\pgfnodepartrightbox + \pgf@yb=\ht\pgfnodepartrightbox + \fi + \advance\pgf@ya by \pgf@yb + % + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya by 2\pgf@yc + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@yb>\pgf@ya + \pgf@ya=\pgf@yb + \fi + % lower side of the shape + \advance\pgf@y by -.5\pgf@ya + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \advance\pgf@y by -\pgf@ya + }% + \savedanchor\northeast{% + % first, let's calculate the real center again: + % + \pgf@x=-.5\wd\pgfnodepartleftbox + \advance\pgf@x by .5\wd\pgfnodeparttextbox + \advance\pgf@x by .5\wd\pgfnodepartrightbox + % + \pgf@y=\dp\pgfnodeparttextbox + \ifdim\dp\pgfnodepartleftbox>\pgf@y + \pgf@y=\dp\pgfnodepartleftbox + \fi + \ifdim\dp\pgfnodepartrightbox>\pgf@y + \pgf@y=\dp\pgfnodepartrightbox + \fi + % + \pgf@ya=\ht\pgfnodeparttextbox + \ifdim\ht\pgfnodepartleftbox>\pgf@ya + \pgf@ya=\ht\pgfnodepartleftbox + \fi + \ifdim\ht\pgfnodepartrightbox>\pgf@ya + \pgf@ya=\ht\pgfnodepartrightbox + \fi + \advance\pgf@ya by -\pgf@y + \pgf@y=.5\pgf@ya + % + % now we can calculate the anchor + % total width + % + \pgf@xa=\wd\pgfnodepartleftbox + \advance\pgf@xa by\wd\pgfnodepartrightbox + \advance\pgf@xa by\wd\pgfnodeparttextbox + % + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa by 2\pgf@xc + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@xb>\pgf@xa + \pgf@xa=\pgf@xb + \fi + % right side of shape + \advance\pgf@x by .5\pgf@xa + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \advance\pgf@x by \pgf@xa + % + % total height + \pgf@ya=\dp\pgfnodepartleftbox + \ifdim\pgf@ya<\dp\pgfnodeparttextbox + \pgf@ya=\dp\pgfnodeparttextbox + \fi + \ifdim\pgf@ya<\dp\pgfnodepartrightbox + \pgf@ya=\dp\pgfnodepartrightbox + \fi + \pgf@yb=\ht\pgfnodepartleftbox + \ifdim\pgf@yb<\ht\pgfnodeparttextbox + \pgf@yb=\ht\pgfnodeparttextbox + \fi + \ifdim\pgf@yb<\ht\pgfnodepartrightbox + \pgf@yb=\ht\pgfnodepartrightbox + \fi + \advance\pgf@ya by \pgf@yb + % + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya by 2\pgf@yc + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@yb>\pgf@ya + \pgf@ya=\pgf@yb + \fi + % upper side of the shape + \advance\pgf@y by .5\pgf@ya + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \advance\pgf@y by \pgf@ya + }% + % + \anchor{center}{% + \ifcase\pgfkeysvalueof{/pgf/uncentered rectangle center/@center}\relax + \realCenter\or + \leftCenter\or + \middleCenter\or + \rightCenter\else + \realCenter + \fi + \pgfkeysgetvalue{/pgf/uncentered rectangle center yshift}\pgf@temp + \pgfutil@ifxempty\pgf@temp{% real center used + }{% calculate center + \pgfmathsetlength\pgf@y{\pgf@temp}% + }% + }% + \anchor{left} {\leftCenter \multiply\pgf@x by2 \pgf@y=0pt } + \anchor{right} {\middleCenter\multiply\pgf@x by2 \pgf@y=0pt } + \anchor{real center} {\realCenter} + \anchor{left center} {\leftCenter} + \anchor{right center}{\rightCenter} + \anchor{text center} {\middleCenter} + \anchor{south west} {\southwest} + \anchor{north east} {\northeast} + \anchor{mid}{% + \csname pgf@anchor@uncentered rectangle@center\endcsname + \pgfmathsetlength\pgf@y{.5ex}}% + \anchor{base}{% + \csname pgf@anchor@uncentered rectangle@center\endcsname + \pgf@y=0pt }% + \anchor{left mid} {\leftCenter \pgfmathsetlength\pgf@y{+.5ex}} + \anchor{text mid} {\middleCenter\pgfmathsetlength\pgf@y{+.5ex}} + \anchor{right mid} {\rightCenter \pgfmathsetlength\pgf@y{+.5ex}} + \anchor{real mid} {\realCenter \pgfmathsetlength\pgf@y{+.5ex}} + \anchor{left base} {\leftCenter \pgf@y=0pt } + \anchor{text base} {\middleCenter\pgf@y=0pt } + \anchor{right base} {\rightCenter \pgf@y=0pt } + \anchor{real base} {\realCenter \pgf@y=0pt } + \anchor{real south} {\pgf@anchor@rectangle@south} + \anchor{real north} {\pgf@anchor@rectangle@north} + \anchor{text north} {\pgf@anchor@rectangle@north\pgf@ya=\pgf@y\middleCenter\pgf@y=\pgf@ya} + \anchor{left north} {\pgf@anchor@rectangle@north\pgf@ya=\pgf@y\leftCenter \pgf@y=\pgf@ya} + \anchor{right north}{\pgf@anchor@rectangle@north\pgf@ya=\pgf@y\rightCenter \pgf@y=\pgf@ya} + \anchor{text south} {\pgf@anchor@rectangle@south\pgf@ya=\pgf@y\middleCenter\pgf@y=\pgf@ya} + \anchor{left south} {\pgf@anchor@rectangle@south\pgf@ya=\pgf@y\leftCenter \pgf@y=\pgf@ya} + \anchor{right south}{\pgf@anchor@rectangle@south\pgf@ya=\pgf@y\rightCenter \pgf@y=\pgf@ya} + \anchor{north}{% + \pgf@anchor@rectangle@north + \pgf@ya=\pgf@y + \csname pgf@anchor@uncentered rectangle@center\endcsname + \pgf@y=\pgf@ya + } + \anchor{south}{% + \pgf@anchor@rectangle@south + \pgf@ya=\pgf@y + \csname pgf@anchor@uncentered rectangle@center\endcsname + \pgf@y=\pgf@ya + } + %\anchor{base right}{\middleCenter\pgf@xa=2\pgf@x}% TODO + \anchor{real west}{% + \pgf@process{\northeast}% + \pgf@ya=.5\pgf@y + \pgf@process{\southwest}% + \pgf@y=.5\pgf@y + \advance\pgf@y by \pgf@ya + }% + \anchor{real east}{% + \pgf@process{\southwest}% + \pgf@ya=.5\pgf@y + \pgf@process{\northeast}% + \pgf@y=.5\pgf@y + \advance\pgf@y by \pgf@ya + }% + \anchor{west}{% + \pgf@process{\southwest}% + \pgf@xa=\pgf@x + \pgf@process{\csname pgf@anchor@uncentered rectangle@center\endcsname}% + \pgf@x=\pgf@xa + }% + \anchor{east}{% + \pgf@process{\northeast}% + \pgf@xa=\pgf@x + \pgf@process{\csname pgf@anchor@uncentered rectangle@center\endcsname}% + \pgf@x=\pgf@xa + }% + \inheritanchor[from=rectangle]{south west} + \inheritanchor[from=rectangle]{north west} + \inheritanchor[from=rectangle]{south east} + \inheritanchor[from=rectangle]{north east} + \inheritanchor[from=rectangle]{mid west} + \inheritanchor[from=rectangle]{mid east} + \inheritanchor[from=rectangle]{base west} + \inheritanchor[from=rectangle]{base east} + \inheritbackgroundpath[from=rectangle] + \anchorborder{% + % xa/ya is target + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + % xc/yc is "center" + \pgf@sh@reanchor{uncentered rectangle}{center}% + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \ifdim\pgf@xa<0pt + % left side + \southwest + \advance\pgf@x by -\pgf@xc + \advance\pgf@y by -\pgf@yc + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + \edef\pgf@marshal{% + \noexpand\pgfpointborderrectangle + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + }% + \else + % right side + \northeast + \advance\pgf@x by -\pgf@xc + \advance\pgf@y by -\pgf@yc + \edef\pgf@marshal{% + \noexpand\pgfpointborderrectangle + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + }% + \fi + \pgf@process{\pgf@marshal}% + \advance\pgf@x by\pgf@xc + \advance\pgf@y by\pgf@yc + }% +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.transformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.transformations.mirror.code.tex new file mode 100644 index 0000000000..4d962ccb1c --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.transformations.mirror.code.tex @@ -0,0 +1,96 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\def\pgftransformxmirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@xa\pgfmathresult pt\relax + \multiply\pgf@xa2 + \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% + \else + \pgftransformmirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% + \fi +} +\def\pgftransformymirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@ya\pgfmathresult pt\relax + \multiply\pgf@ya2 + \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% + \else + \edef\pgf@marshal{\noexpand\pgftransformmirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% + {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% + \pgf@marshal + \fi} +\def\pgftransformmirror#1#2{% + \pgfextract@process\pgf@tempa{#1}% + \pgfpointnormalised{\pgfpointdiff{\pgf@tempa}{#2}}% + \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x + \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x + \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y + \multiply\pgf@xa2 + \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb + \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb + \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% + \expandafter\pgf@transformcm\pgf@temp{\pgf@tempa}% + \pgftransformshift{\pgfpointscale{-1}{\pgf@tempa}}% +} + +\def\pgfqtransformmirror#1{% + \pgfpointnormalised{#1}% + \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x + \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x + \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y + \multiply\pgf@xa2 + \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb + \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb + \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% + \expandafter\pgf@transformcm\pgf@temp{\pgfpointorigin}% +} + +% Using existant transformation (shift, rotate, yscale=-1, rotate back, shift back) +\def\pgftransformxMirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@xa\pgfmathresult pt\relax + \multiply\pgf@xa2 + \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% + \else + \pgftransformMirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% + \fi +} +\def\pgftransformyMirror#1{ + \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgf@ya\pgfmathresult pt\relax + \multiply\pgf@ya2 + \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% + \else + \edef\pgf@marshal{\noexpand\pgftransformMirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% + {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% + \pgf@marshal + \fi} + +\def\pgftransformMirror#1#2{% + \pgfextract@process\pgf@tempa{#1}% + \pgfmathanglebetweenpoints{\pgf@tempa}{#2}% + \let\pgf@temp\pgfmathresult + \pgftransformshift{\pgf@tempa}% + \pgftransformrotate{\pgf@temp}% + \pgftransformyscale{-1}% + \pgftransformrotate{-\pgf@temp}% + \pgftransformshift{\pgfqpointscale{-1}{\pgf@tempa}}% +} + +\def\pgfqtransformMirror#1{% + \pgfmathanglebetweenpoints{\pgfpointorigin}{#1}% + \let\pgf@temp\pgfmathresult + \pgftransformrotate{\pgf@temp}% + \pgftransformyscale{-1}% + \pgftransformrotate{-\pgf@temp}% +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfcalendar-ext.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfcalendar-ext.code.tex deleted file mode 100644 index fae3508e15..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfcalendar-ext.code.tex +++ /dev/null @@ -1,370 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\pgfqkeys{/pgf/calendar}{ - style/.style={#1}, - yesterday/.value required, - yesterday/.code={% - \begingroup - \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax - \advance\pgfutil@tempcnta by -1\relax - \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% - \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% - \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb - \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% - \pgfcalendarjulianyeartoweek\pgfutil@tempcnta\pgfcalendarifdateyear\pgfutil@tempcntb - \edef\pgfcalendarifdateweek{\the\pgfutil@tempcntb}% - \pgfcalendar@launch@ifdate{#1}{% - \def\pgf@cal@temp{\pgfcalendarmatchestrue}% - }{% - \let\pgf@cal@temp\pgfutil@empty - }% - \expandafter - \endgroup\pgf@cal@temp - }, - relative/.code 2 args={% - \begingroup - \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax - \advance\pgfutil@tempcnta by #1\relax - \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% - \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% - \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb - \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% - \pgfcalendarjulianyeartoweek\pgfutil@tempcnta\pgfcalendarifdateyear\pgfutil@tempcntb - \edef\pgfcalendarifdateweek{\the\pgfutil@tempcntb}% - \pgfcalendar@launch@ifdate{#2}{% - \def\pgf@cal@temp{\pgfcalendarmatchestrue}% - }{% - \let\pgf@cal@temp\pgfutil@empty - }% - \expandafter - \endgroup\pgf@cal@temp - }, - Jan/.code={\ifnum\pgfcalendarifdatemonth=1 \expandafter\pgfcalendarmatchestrue\fi},Jan/.value forbidden, - Feb/.code={\ifnum\pgfcalendarifdatemonth=2 \expandafter\pgfcalendarmatchestrue\fi},Feb/.value forbidden, - Mar/.code={\ifnum\pgfcalendarifdatemonth=3 \expandafter\pgfcalendarmatchestrue\fi},Mar/.value forbidden, - Apr/.code={\ifnum\pgfcalendarifdatemonth=4 \expandafter\pgfcalendarmatchestrue\fi},Apr/.value forbidden, - May/.code={\ifnum\pgfcalendarifdatemonth=5 \expandafter\pgfcalendarmatchestrue\fi},May/.value forbidden, - Jun/.code={\ifnum\pgfcalendarifdatemonth=6 \expandafter\pgfcalendarmatchestrue\fi},Jun/.value forbidden, - Jul/.code={\ifnum\pgfcalendarifdatemonth=7 \expandafter\pgfcalendarmatchestrue\fi},Jul/.value forbidden, - Aug/.code={\ifnum\pgfcalendarifdatemonth=8 \expandafter\pgfcalendarmatchestrue\fi},Aug/.value forbidden, - Sep/.code={\ifnum\pgfcalendarifdatemonth=9 \expandafter\pgfcalendarmatchestrue\fi},Sep/.value forbidden, - Oct/.code={\ifnum\pgfcalendarifdatemonth=10 \expandafter\pgfcalendarmatchestrue\fi},Oct/.value forbidden, - Nov/.code={\ifnum\pgfcalendarifdatemonth=11 \expandafter\pgfcalendarmatchestrue\fi},Nov/.value forbidden, - Dec/.code={\ifnum\pgfcalendarifdatemonth=12 \expandafter\pgfcalendarmatchestrue\fi},Dec/.value forbidden, - % - leap year/.code={% - \pgfutil@tempcnta=#1\relax - \divide\pgfutil@tempcnta4 - \multiply\pgfutil@tempcnta4 - \ifnum\pgfutil@tempcnta=#1\relax - \divide\pgfutil@tempcnta100 - \multiply\pgfutil@tempcnta100 - \ifnum\pgfutil@tempcnta=#1\relax - \divide\pgfutil@tempcnta400 - \multiply\pgfutil@tempcnta400 - \ifnum\pgfutil@tempcnta=#1\relax - \pgfcalendarmatchestrue - \fi - \else - \pgfcalendarmatchestrue - \fi - \fi}, - leap year/.default=\pgfcalendarifdateyear, - between days/.value required, - between days/.code args={#1and#2}{% - \pgfutil@tempcnta=#1\relax - \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta\else - \pgfutil@tempcnta=#2\relax - \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta\else - \pgfcalendarmatchestrue\fi\fi}, - week of month/.code={% - \pgfutil@tempcnta=#1\relax - \multiply\pgfutil@tempcnta7 - \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta\else - \advance\pgfutil@tempcnta-7 - \ifnum\pgfcalendarifdateday>\pgfutil@tempcnta - \pgfcalendarmatchestrue - \fi - \fi}, - week of month'/.code={% - \pgfcalendar@getlastYMX\pgfcalendarifdateyear\pgfcalendarifdatemonth\pgfutil@tempcnta - \advance\pgfutil@tempcnta1 - \pgfutil@tempcntb=#1\relax - \multiply\pgfutil@tempcntb7 - \advance\pgfutil@tempcnta-\pgfutil@tempcntb - \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta\else - \advance\pgfutil@tempcnta+7 - \ifnum\pgfcalendarifdateday<\pgfutil@tempcnta - \pgfcalendarmatchestrue - \fi - \fi}, - first/.code={\pgfutil@in@:{#1}\ifpgfutil@in@ - \pgfcalendar@ifdate@first{}#1\pgf@stop\else - \pgfcalendar@ifdate@first{}1:#1\pgf@stop\fi}, - last/.code={\pgfutil@in@:{#1}\ifpgfutil@in@ - \pgfcalendar@ifdate@first'#1\pgf@stop\else - \pgfcalendar@ifdate@first'1:#1\pgf@stop\fi}, - % logic - not/.value required, - not/.code=% - \begingroup - \let\pgf@cal@tempa\pgfutil@empty - \pgfcalendar@launch@ifdate{#1}{}{\def\pgf@cal@tempa{\pgfcalendarmatchestrue}}% - \expandafter\endgroup\pgf@cal@tempa, - and/.value required, - and/.code=% and = {, , , …} - \begingroup - \pgfcalendarmatchestrue - \pgfqkeys{/pgf/calendar/and}{#1}% - \ifpgfcalendarmatches % is it still true? - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\def\pgf@cal@temp{\pgfcalendarmatchestrue}}% - {\let\pgf@cal@temp\pgfutil@empty}% - \expandafter\endgroup\pgf@cal@temp, - and/.unknown/.code=% only inside the group of and/.code - \ifpgfcalendarmatches - \expandafter\pgfutil@firstofone - \else - \expandafter\pgfutil@gobble - \fi - {% - \begingroup - \pgfcalendar@launch@ifdate{\pgfkeyscurrentname={#1}}% - {\let\pgf@cal@temp\pgfutil@empty}{\def\pgf@cal@temp{\pgfcalendarmatchesfalse}} - \expandafter\endgroup\pgf@cal@temp - },% - calendar week of month/.default=1, - calendar week of month'/.default=1, - calendar week of month/.code={% - \begingroup - \pgfutil@tempcnta=\pgfcalendarifdateday\relax - \advance\pgfutil@tempcnta by 5 - \advance\pgfutil@tempcnta by -\pgfcalendarifdateweekday\relax - \divide\pgfutil@tempcnta by 7 - \advance\pgfutil@tempcnta by -#1\relax - \expandafter\endgroup\expandafter - \ifnum\the\pgfutil@tempcnta=-1 - \pgfcalendarmatchestrue - \fi}, - calendar week of month'/.code={% - \begingroup - \pgfcalendar@getlastYMX\pgfcalendarifdateyear\pgfcalendarifdatemonth\pgfutil@tempcnta - \advance\pgfutil@tempcnta by -\pgfcalendarifdateday\relax - \edef\pgfcalendarifdateday{\the\pgfutil@tempcnta}% - \pgfutil@tempcnta=-\pgfcalendarifdateweekday\relax - \advance\pgfutil@tempcnta by 5 - \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcnta}% - \let\pgf@cal@temp\pgfutil@empty - \pgfcalendar@launch@ifdate{calendar week of month={#1}}{\def\pgf@cal@temp{\pgfcalendarmatchestrue}}{}% - \expandafter\endgroup\pgf@cal@temp}} - -\def\pgfcalendar@ifdate@first#1#2:#3\pgf@stop{% - \pgfqkeys{/pgf/calendar}{and={#3, week of month#1={#2}}}} -\def\pgfcalendar@getlastYMX#1#2#3{% #1 = year, #2 = month, #3 := last day - \begingroup - \ifnum#2=2 % stupid February - \pgfcalendarmatchesfalse - \pgfqkeys{/pgf/calendar}{leap year={#1}}% - \ifpgfcalendarmatches - #3=29 - \else - #3=28 - \fi - \else - #3=\ifcase#2\relax\or - 31\or\or31\or30\or31\or30\or31\or31\or30\or31\or30\or31\fi - \fi - \edef\pgf@cal@temp{#3=\the#3\relax} - \expandafter - \endgroup\pgf@cal@temp} - -% -% weeks -% -\def\pgfcalendar@week@setup#1{% - \pgfutil@IfUndefined{pgfcalendar@week@#1}{% - \begingroup - \pgfcalendardatetojulian{#1-01-01}\pgfutil@tempcnta - \pgfcalendarjuliantoweekday\pgfutil@tempcnta\pgfutil@tempcntb - % - % tempcnta holds the julian number for first day of the current year - % tempcntb holds the weekday for the first day of the current year - % - % set tempcnta to the Monday of the week with first day of current year - \advance\pgfutil@tempcnta by -\pgfutil@tempcntb - % - % if the first week starts at Fri, Sat or Sun, next week is the 1st week - \ifnum\pgfutil@tempcntb>3\relax - \advance\pgfutil@tempcnta by 7\relax - \fi - % setup macro for year with {Julian number for day of first week}{weekday of -01-01} - \expandafter\xdef\csname pgfcalendar@week@#1\endcsname{{\the\pgfutil@tempcnta}{\the\pgfutil@tempcntb}}% - \endgroup - }{}% -} - -\def\pgfcalendarjulianyeartoweek#1#2#3{\pgfcalendarjulianyeartoweek@{#1}{#2}{#3}{\iftrue}} -\def\pgfcalendarjulianyeartoweek@#1#2#3#4{% - % #1 = julian date (count) - % #2 = year - % #3 = count that holds the week at the end - % #4 = \iftrue or \iffalse: whether week 53 needs to be checked (\iffalse when determing week from next year) - \begingroup - \pgfcalendar@week@setup{#2}% - #3=#1\relax - % - % calculate difference of days between current date and start of week 1 - % - \advance#3 by -\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgfcalendar@week@#2\endcsname\relax - \ifnum#3<0\relax % whoops, we are in the week of the previous year - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {% if first day of the year is Fri, Sat or Sun - \ifnum\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname pgfcalendar@week@#2\endcsname>3\relax - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {% we need to check the week of the previous year - #3=#2\relax - \advance#3 by -1 - \edef\pgf@cal@temp{\noexpand\pgfcalendarjulianyeartoweek@{#1}{\the#3}{#3}\noexpand\iffalse}% - \pgf@cal@temp - }{% yeah, it's weird - \divide#3 by 7 - \advance#3 by 1 - }% - }{% - \divide#3 by 7 - \advance#3 by 1 - #4% - \expandafter\pgfutil@firstofone - \else - \expandafter\pgfutil@gobble - \fi - {% - \ifnum#3=53\relax % whoops, we are possibly in the first week of the next year - \expandafter\pgfutil@firstofone - \else - \expandafter\pgfutil@gobble - \fi - {% - \begingroup - % check whether we're already in week 1 of the next year - #3=#2\relax - \advance#3 by 1 - \expandafter\pgfcalendar@week@setup\expandafter{\the#3}% - \ifnum#1<\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgfcalendar@week@\the#3\endcsname\relax - #3=53 - \else - #3=1 - \fi - \expandafter - \endgroup\expandafter#3\the#3\relax - }% - }% - }% - \expandafter - \endgroup\expandafter - #3\the#3\relax -} - -% -% shorthands for weeks (n) -% -% n-: shortest -% n=: shortest but prepends whitespace -% n0: leading zero -% -\expandafter\def\csname pgfcalendar@shorthand@n-\endcsname{% - \if0\pgfcalendarcurrentweek\else\pgfcalendarcurrentweek\fi} -\expandafter\def\csname pgfcalendar@shorthand@n=\endcsname{% - {\pgfutil@tempcnta=\pgfcalendarcurrentweek\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} -\expandafter\def\csname pgfcalendar@shorthand@n0\endcsname{% - \pgfcalendarcurrentweek} - -% -% Overwriting original \pgfcalendar -% -\long\def\pgfcalendar#1#2#3#4{% - \begingroup% - % Setup local \ifdate - \let\ifdate=\pgfcalendar@local@ifdate% - % Let's start with computing start and end dates... - \def\pgfcalendarprefix{#1}% - \pgfcalendardatetojulian{#2}{\pgfcalendarcurrentjulian}% - \edef\pgfcalendarbeginjulian{\the\pgfcalendarcurrentjulian}% - \edef\pgfcalendarbeginiso{#2}% - \pgfcalendardatetojulian{#3}{\pgfutil@tempcnta}% - \edef\pgfcalendarendjulian{\the\pgfutil@tempcnta}% - \advance\pgfutil@tempcnta by1\relax% - \edef\pgfcalendarendjulianplus{\the\pgfutil@tempcnta}% - \edef\pgfcalendarendiso{#3}% - % - % Start main loop - % - \loop% - \ifnum\pgfcalendarcurrentjulian<\pgfcalendarendjulianplus\relax% - % Setup information about current date - \pgfcalendarjuliantodate{\pgfcalendarcurrentjulian}% - {\pgfcalendarcurrentyear}{\pgfcalendarcurrentmonth}{\pgfcalendarcurrentday}% - \pgfcalendarjuliantoweekday{\pgfcalendarcurrentjulian}{\pgfutil@tempcntb}% - \edef\pgfcalendarcurrentweekday{\the\pgfutil@tempcntb}% - \pgfcalendarjulianyeartoweek{\pgfcalendarcurrentjulian}{\pgfcalendarcurrentyear}{\pgfutil@tempcntb}% - \edef\pgfcalendarcurrentweek{\ifnum\pgfutil@tempcntb<10 0\fi\the\pgfutil@tempcntb}% - % Render: - #4% - % Advance day: - \advance\pgfcalendarcurrentjulian by1\relax% - \repeat% - \endgroup% -} - -% -% Overwriting original \pgfcalendar@local@ifdate -% -\def\pgfcalendar@local@ifdate{% - \let\pgfcalendarifdatejulian=\pgfcalendarcurrentjulian - \let\pgfcalendarifdateyear=\pgfcalendarcurrentyear - \let\pgfcalendarifdatemonth=\pgfcalendarcurrentmonth - \let\pgfcalendarifdateday=\pgfcalendarcurrentday - \let\pgfcalendarifdateweekday=\pgfcalendarcurrentweekday - \let\pgfcalendarifdateweek=\pgfcalendarcurrentweek - \pgfcalendar@launch@ifdate% -} -% -% Overwritigin original \pgfcalendarifdate -% -\def\pgfcalendarifdate#1#2#3#4{% - \pgfcalendardatetojulian{#1}{\pgfutil@tempcnta}% - \pgfcalendarjuliantodate{\pgfutil@tempcnta} - {\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% - \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% - % Compute info about date - \pgfcalendarjuliantoweekday{\pgfutil@tempcnta}{\pgfutil@tempcntb}% - \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% - \pgfcalendarjulianyeartoweek{\pgfcalendarifdatejulian}{\pgfcalendarifdateyear}{\pgfutil@tempcntb}% - \edef\pgfcalendarifdateweek{\ifnum\pgfutil@tempcntb<10 0\fi\the\pgfutil@tempcntb}% - % - \pgfcalendar@launch@ifdate{#2}{#3}{#4}% -} - -\pgfqkeys{/pgf/calendar/week}{.value required,.code={\ifnum#1=\pgfcalendarifdateweek\relax\expandafter\pgfcalendarmatchestrue\fi}} - -% Overwriting shorthands of pgfcalendar -\expandafter\def\csname pgfcalendar@shorthand@d-\endcsname{% - \if0\pgfcalendarcurrentday\else\pgfcalendarcurrentday\fi} -\expandafter\def\csname pgfcalendar@shorthand@m-\endcsname{% - \if0\pgfcalendarcurrentmonth\else\pgfcalendarcurrentmonth\fi} - -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex deleted file mode 100644 index 49aedb64c6..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgfkeyslibraryext.pgfkeys-plus.code.tex +++ /dev/null @@ -1,139 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\input pgfmath.tex - -%% Handlers -%% .pgfmath evaluates values given to keys in PGFmath before handing them over. -%% .pgfmath int truncates the result -%% .pgfmath strcat concatenates the given values -\pgfqkeys{/handlers}{ - .pgfmath/.code=% - \begingroup - \pgfmathparse{#1}% - \expandafter\endgroup\expandafter - \pgfkeys@exp@call\expandafter{\pgfmathresult}, - .pgfmath int/.code=% - \begingroup - \pgfmathint{#1}% - \expandafter\endgroup\expandafter - \pgfkeys@exp@call\expandafter{\pgfmathresult}, - .pgfmath wrap/.code 2 args={% - \def\pgfkeys@temp##1{\def\pgfkeys@temp{#1}}% - \begingroup - \pgfmathparse{#2}% - \expandafter\pgfkeys@temp\expandafter{\pgfmathresult}% - \expandafter\endgroup\expandafter - \pgfkeys@exp@call\expandafter{\pgfkeys@temp}% - }, - .pgfmath if/.code n args={3}{% - \begingroup - \pgfmathifthenelse{#1}{"1"}{"0"}% - \expandafter\endgroup\expandafter - \ifcase\pgfmathresult\relax - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeys@exp@call{#3}}% - {\pgfkeys@exp@call{#2}}% - }, - .if/.code n args={4}{% - \if#1#2% - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeys@exp@call{#3}}% - {\pgfkeys@exp@call{#4}}% - }, - .ifnum/.code n args={3}{% - \ifnum#1\relax - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeys@exp@call{#2}}% - {\pgfkeys@exp@call{#3}}% - }, - .ifdim/.code n args={3}{% - \ifdim#1\relax - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeys@exp@call{#2}}% - {\pgfkeys@exp@call{#3}}% - }, - .ifx/.code n args={4}{% - \ifx#1#2% - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeys@exp@call{#3}}% - {\pgfkeys@exp@call{#4}}% - }, - .ifxempty/.code n args={3}{% - \edef\pgfkeys@temp{#1}% - \pgfutil@ifxempty\pgfkeys@temp{\pgfkeys@exp@call{#2}}{\pgfkeys@exp@call{#3}}% - }, - .ifempty/.code n args={3}{% - \pgfutil@ifempty{#1}{\pgfkeys@exp@call{#2}}{\pgfkeys@exp@call{#3}}% - }, - %% http://tex.stackexchange.com/a/144187/16595 - %% key/.List={(point-1),(point-2),(point-...),(point-6)} will call - %% key=(point-1)(point-2)(point-3)(point-4)(point-5),(point-6) - .List/.code=% - \let\pgfkeys@global@temp\pgfutil@empty - \foreach\pgfkeys@temp in{#1}{% - \expandafter\pgfutil@g@addto@macro\expandafter\pgfkeys@global@temp\expandafter{\pgfkeys@temp}% - }% - \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@global@temp}% -} - -\pgfqkeys{/utils}{ - if/.code n args={3}{% - \begingroup - \pgfmathifthenelse{#1}{"1"}{"0"}% - \expandafter\endgroup\expandafter - \ifcase\pgfmathresult\relax - \expandafter\pgfutil@firstoftwo - \else - \expandafter\pgfutil@secondoftwo - \fi - {\pgfkeysalso{#3}} - {\pgfkeysalso{#2}}% - }, - TeX/if/.code n args={4}{% - \if#1#2\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% - }, - TeX/ifnum/.code n args={3}{% - \ifnum#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - TeX/ifdim/.code n args={3}{% - \ifdim#1\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - TeX/ifx/.code n args={4}{% - \ifx#1#2\relax\expandafter\pgfutil@firstoftwo\else\expandafter\pgfutil@secondoftwo\fi - {\pgfkeysalso{#3}}{\pgfkeysalso{#4}}% - }, - TeX/ifxempty/.code n args={3}{% - \edef\pgfkeys@temp{#1}% - \pgfutil@ifxempty\pgfkeys@temp{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - TeX/ifempty/.code n args={3}{% - \pgfutil@ifempty{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - tex/.search also=/utils/TeX, -} - -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.pgfkeys-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.pgfkeys-plus.code.tex deleted file mode 100644 index 6101ca8cad..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.pgfkeys-plus.code.tex +++ /dev/null @@ -1,11 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\input pgfkeyslibraryext.pgfkeys-plus.code.tex - -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlearrow.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlearrow.code.tex deleted file mode 100644 index 9eb1c6ab09..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlearrow.code.tex +++ /dev/null @@ -1,66 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\pgfset{ - circle arrow start angle/.initial=, - circle arrow end angle/.initial=, - circle arrow delta angle/.initial=, - circle arrow arrows/.initial=-, - circle arrow/@turn left/.style={/pgf/circle arrow arrows=->,/pgf/circle arrow delta angle=340}, - circle arrow/@turn right/.style={/pgf/circle arrow arrows=<-,/pgf/circle arrow delta angle=340}, - circle arrow turn left north/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=100}, - circle arrow turn left east/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=10}, - circle arrow turn left south/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=280}, - circle arrow turn left west/.style = {/pgf/circle arrow/@turn left, /pgf/circle arrow start angle=190}, - circle arrow turn right north/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=100}, - circle arrow turn right east/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=10}, - circle arrow turn right south/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=280}, - circle arrow turn right west/.style = {/pgf/circle arrow/@turn right, /pgf/circle arrow start angle=190}, -} -\pgfdeclareshape{circle arrow}{ - \inheritsavedanchors[from=circle] - \inheritanchorborder[from=circle] - \inheritanchor[from=circle]{north} - \inheritanchor[from=circle]{north west} - \inheritanchor[from=circle]{north east} - \inheritanchor[from=circle]{center} - \inheritanchor[from=circle]{west} - \inheritanchor[from=circle]{east} - \inheritanchor[from=circle]{mid} - \inheritanchor[from=circle]{mid west} - \inheritanchor[from=circle]{mid east} - \inheritanchor[from=circle]{base} - \inheritanchor[from=circle]{base west} - \inheritanchor[from=circle]{base east} - \inheritanchor[from=circle]{south} - \inheritanchor[from=circle]{south west} - \inheritanchor[from=circle]{south east} - \backgroundpath{ - \pgfkeysgetvalue{/pgf/circle arrow start angle}\pgf@sh@circlearrow@s - \pgfkeysgetvalue{/pgf/circle arrow end angle}\pgf@sh@circlearrow@e - \pgfkeysgetvalue{/pgf/circle arrow delta angle}\pgf@sh@circlearrow@d - \ifx\pgf@sh@circlearrow@s\pgfutil@empty% - \pgfmathsetmacro\pgf@sh@circlearrow@s{\pgf@sh@circlearrow@e-\pgf@sh@circlearrow@d}% - \else - \ifx\pgf@sh@circlearrow@e\pgfutil@empty% - \pgfmathsetmacro\pgf@sh@circlearrow@e{\pgf@sh@circlearrow@s+\pgf@sh@circlearrow@d}% - \fi% - \fi - \pgfutil@tempdima=\radius - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@xb<\pgf@yb - \advance\pgfutil@tempdima by-\pgf@yb - \else - \advance\pgfutil@tempdima by-\pgf@xb - \fi - \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfpointpolar{\pgf@sh@circlearrow@s}{\pgfutil@tempdima}}}% - \pgfpatharc{\pgf@sh@circlearrow@s}{\pgf@sh@circlearrow@e}{\pgfutil@tempdima}% - \pgfkeysgetvalue{/pgf/circle arrow arrows}\pgf@temp - \expandafter\pgfsetarrows\expandafter{\pgf@temp}% - } -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlecrosssplit.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlecrosssplit.code.tex deleted file mode 100644 index 7bc2761fb4..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.circlecrosssplit.code.tex +++ /dev/null @@ -1,292 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\usepgflibrary{shapes.multipart} -\let\pgfnodeparttrbox\pgfnodeparttwobox -\let\pgfnodepartblbox\pgfnodepartthreebox -\let\pgfnodepartbrbox\pgfnodepartfourbox -\newif\ifpgfcirclecrosssplitcustomfill -\pgfset{% - circle cross split part fill/.code=% - \def\pgf@lib@sh@ccs@list@fill{#1}% - \pgfcirclecrosssplitcustomfilltrue,% - circle cross split uses custom fill/.is if=pgfcirclecrosssplitcustomfill -} -\def\pgf@lib@sh@ccs@list@fill{none}% -\pgfdeclareshape{circle cross split}{% - \nodeparts{text,two,three,four}% - \savedanchor\centerpoint{% - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% - \pgf@x =\wd\pgfnodeparttextbox - \pgf@yb=\dp\pgfnodeparttextbox - \pgf@y=\dp\pgfnodeparttwobox - \ifdim\pgf@yb>\pgf@y - \pgf@y=\pgf@yb - \fi - \advance\pgf@x\pgf@xa - \advance\pgf@y-\pgf@ya - \advance\pgf@x.5\pgflinewidth - \advance\pgf@y-.5\pgflinewidth - }% - \savedanchor\twoanchor{% - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@x.5\pgflinewidth - \advance\pgf@x\pgf@xa - \advance\pgf@y.5\pgflinewidth - \advance\pgf@y\pgf@ya - \pgf@yb\dp\pgfnodeparttextbox - \pgf@yc\dp\pgfnodeparttwobox - \ifdim\pgf@yb>\pgf@yc - \pgf@yc\pgf@yb - \fi - \advance\pgf@y\pgf@yc - }% - \savedanchor\threeanchor{% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% - \pgf@x\wd\pgfnodeparttextbox - \pgf@yb\dp\pgfnodeparttextbox - \pgf@yc\dp\pgfnodeparttwobox - \ifdim\pgf@yb>\pgf@yc - \pgf@yc\pgf@yb - \fi - \advance\pgf@y-\pgf@yc - \advance\pgf@y-2\pgf@ya - \advance\pgf@y-\pgflinewidth - \pgf@yb\ht\pgfnodepartthreebox - \pgf@yc\ht\pgfnodepartfourbox - \ifdim\pgf@yb>\pgf@yc - \pgf@yc\pgf@yb - \fi - \advance\pgf@y-\pgf@yc - \advance\pgf@x-\wd\pgfnodepartthreebox - }% - \saveddimen\radius{% - % height (upper): - \pgf@y=\ht\pgfnodeparttextbox - \ifdim\pgf@y<\ht\pgfnodeparttwobox - \pgf@y=\ht\pgfnodeparttwobox - \fi - \ifdim\dp\pgfnodeparttextbox>\dp\pgfnodeparttwobox - \advance\pgf@y by\dp\pgfnodeparttextbox - \else - \advance\pgf@y by\dp\pgfnodeparttwobox - \fi - % height (lower): - \pgf@yb\ht\pgfnodepartthreebox - \ifdim\pgf@yb<\ht\pgfnodepartfourbox - \pgf@yb=\ht\pgfnodepartfourbox - \fi - \pgf@yc=\dp\pgfnodepartthreebox - \ifdim\pgf@yc<\dp\pgfnodepartfourbox - \advance\pgf@yb by\dp\pgfnodepartfourbox - \else - \advance\pgf@yb by\pgf@yc - \fi - \ifdim\pgf@yc>\pgf@y - \pgf@y=\pgf@yc - \fi - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y2\pgf@ya - % - \pgf@x\wd\pgfnodeparttextbox - \pgf@xa\wd\pgfnodepartthreebox - \pgf@xb\wd\pgfnodeparttwobox - \pgf@xc\wd\pgfnodepartfourbox - \ifdim\pgf@xa>\pgf@x - \pgf@x\pgf@xa - \fi - \ifdim\pgf@xb>\pgf@x - \pgf@x\pgf@xb - \fi - \ifdim\pgf@xc>\pgf@x - \pgf@x\pgf@xc - \fi - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x by 2\pgf@xa - \ifdim\pgf@y>\pgf@x - \pgf@x=\pgf@y - \fi - \advance\pgf@x by\pgflinewidth - % - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - % from circle: - \pgf@process{\pgfpointnormalised{}}% - \ifdim\pgf@x>\pgf@y% - \c@pgf@counta=\pgf@x% - \ifnum\c@pgf@counta=0\relax% - \else% - \divide\c@pgf@counta by 255\relax% - \pgf@xa=16\pgf@xa\relax% - \divide\pgf@xa by\c@pgf@counta% - \pgf@xa=16\pgf@xa\relax% - \fi% - \else% - \c@pgf@counta=\pgf@y% - \ifnum\c@pgf@counta=0\relax% - \else% - \divide\c@pgf@counta by 255\relax% - \pgf@ya=16\pgf@ya\relax% - \divide\pgf@ya by\c@pgf@counta% - \pgf@xa=16\pgf@ya\relax% - \fi% - \fi% - \pgf@x=\pgf@xa% - % - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@x<.5\pgf@xb - \pgf@x=.5\pgf@xb - \fi - \ifdim\pgf@x<.5\pgf@yb - \pgf@x=.5\pgf@yb - \fi - % - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@xb<\pgf@yb - \advance\pgf@x\pgf@yb - \else - \advance\pgf@x\pgf@xb - \fi - }% - \inheritanchorborder[from=circle]% - \inheritanchor[from=circle]{north}% - \inheritanchor[from=circle]{north west}% - \inheritanchor[from=circle]{north east}% - \inheritanchor[from=circle]{center}% - \inheritanchor[from=circle]{west}% - \inheritanchor[from=circle]{east}% - \inheritanchor[from=circle]{mid}% - \inheritanchor[from=circle]{mid west}% - \inheritanchor[from=circle]{mid east}% - \inheritanchor[from=circle]{base}% - \inheritanchor[from=circle]{base west}% - \inheritanchor[from=circle]{base east}% - \inheritanchor[from=circle]{south}% - \inheritanchor[from=circle]{south west}% - \inheritanchor[from=circle]{south east}% - \anchor{two}{\twoanchor}% - \anchor{three}{\threeanchor}% - \anchor{four}{ - \threeanchor - \pgf@ya=\pgf@y - \twoanchor - \pgf@y=\pgf@ya - }% - \anchor{lower base}{% - \threeanchor - \pgf@ya=\pgf@y - \centerpoint - \pgf@y=\pgf@ya - } - \anchor{lower base west}{% - \threeanchor - \pgf@ya=\pgf@y - \centerpoint - \pgf@y=\pgf@ya - \advance\pgf@x by-\radius - } - \anchor{lower base east}{% - \threeanchor - \pgf@ya=\pgf@y - \centerpoint - \pgf@y=\pgf@ya - \advance\pgf@x by\radius - } - \anchor{lower mid}{% - \threeanchor - \pgf@ya=\pgf@y - \centerpoint - \pgf@y=\pgf@ya - \pgfmathsetlength\pgf@ya{+.5ex}% - \advance\pgf@y by\pgf@ya - } - \anchor{lower mid west}{% - \threeanchor - \pgf@ya=\pgf@y - \centerpoint - \pgf@y=\pgf@ya - \advance\pgf@x by-\radius - \pgfmathsetlength\pgf@ya{+.5ex}% - \advance\pgf@y by\pgf@ya - } - \anchor{lower mid east}{% - \threeanchor - \pgf@ya=\pgf@y - \centerpoint - \pgf@y=\pgf@ya - \advance\pgf@x by\radius - \pgfmathsetlength\pgf@ya{+.5ex}% - \advance\pgf@y by\pgf@ya - } - \inheritbackgroundpath[from=circle] - \beforebackgroundpath{% - \pgfutil@tempdima=\radius - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@xb<\pgf@yb - \advance\pgfutil@tempdima by-\pgf@yb - \else - \advance\pgfutil@tempdima by-\pgf@xb - \fi - \advance\pgfutil@tempdima by-.5\pgflinewidth% - \pgfsetshortenstart{0pt}% - \pgfsetshortenend{0pt}% - \pgfsetarrows{-}% - \pgfpathmoveto - {\pgfpointadd{\centerpoint}{\pgfqpoint{-\pgfutil@tempdima}{0pt}}}% - \pgfpathlineto - {\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}% - \pgfpathmoveto - {\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-\pgfutil@tempdima}}}% - \pgfpathlineto - {\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\pgfutil@tempdima}}}% - \pgfusepathqstroke - }% - \behindbackgroundpath{% - \pgfutil@tempdima=\radius - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@xb<\pgf@yb - \advance\pgfutil@tempdima by-\pgf@yb - \else - \advance\pgfutil@tempdima by-\pgf@xb - \fi - \advance\pgfutil@tempdima by-.5\pgflinewidth% - \ifpgfcirclecrosssplitcustomfill% - \pgf@lib@sh@rs@process@list{\pgf@lib@sh@ccs@list@fill}{4}% - {% - \pgfmathloop - \ifnum\pgfmathcounter>4% - \else% - \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}% - \edef\pgf@tempa - {\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}% - \ifx\pgf@tempa\pgf@lib@sh@rs@nonetext\else - \pgfsetfillcolor{\pgf@tempa}% - \ifcase\pgfmathcounter\or - \def\pgf@lib@sh@ccs@angle{90}\or - \def\pgf@lib@sh@ccs@angle{0}\or - \def\pgf@lib@sh@ccs@angle{180}\else - \def\pgf@lib@sh@ccs@angle{270}% - \fi - \pgfpathmoveto{\centerpoint}% - \pgfpathlineto{\pgfpointadd{\centerpoint} - {\pgfqpointpolar{\pgf@lib@sh@ccs@angle}{\pgfutil@tempdima}}}% - \pgfpatharc{+\pgf@lib@sh@ccs@angle}{\pgf@lib@sh@ccs@angle+90} - {+\pgfutil@tempdima}% - \pgfpathclose - \pgfusepathqfill - \fi - \repeatpgfmathloop - }% - \fi - }% -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.heatmark.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.heatmark.code.tex deleted file mode 100644 index 477d0442da..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.heatmark.code.tex +++ /dev/null @@ -1,181 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\pgfset{ - heatmark arc width/.initial=+4pt, - heatmark arc sep/.initial=+1pt, - heatmark arc rings/.initial=3, - heatmark arcs/.initial=3, - heatmark arc sep angle/.initial=20, - heatmark inner opacity/.initial=.8, - heatmark outer opacity/.initial=.2 -} -\pgfdeclareshape{heatmark} -% -% Draws a circle around the text -% -{ - \savedanchor\centerpoint{% - \pgf@x=.5\wd\pgfnodeparttextbox% - \pgf@y=.5\ht\pgfnodeparttextbox% - \advance\pgf@y by-.5\dp\pgfnodeparttextbox% - } - - \saveddimen\innerradius{% - % - % Caculate ``height radius'' - % - \pgf@ya=.5\ht\pgfnodeparttextbox% - \advance\pgf@ya by.5\dp\pgfnodeparttextbox% - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@ya by\pgf@yb% - % - % Caculate ``width radius'' - % - \pgf@xa=.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@xa by\pgf@xb% - % - % Calculate length of radius vector: - % - \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% - \ifdim\pgf@x>\pgf@y% - \c@pgf@counta=\pgf@x% - \ifnum\c@pgf@counta=0\relax% - \else% - \divide\c@pgf@counta by 255\relax% - \pgf@xa=16\pgf@xa\relax% - \divide\pgf@xa by\c@pgf@counta% - \pgf@xa=16\pgf@xa\relax% - \fi% - \else% - \c@pgf@counta=\pgf@y% - \ifnum\c@pgf@counta=0\relax% - \else% - \divide\c@pgf@counta by 255\relax% - \pgf@ya=16\pgf@ya\relax% - \divide\pgf@ya by\c@pgf@counta% - \pgf@xa=16\pgf@ya\relax% - \fi% - \fi% - \pgf@x=\pgf@xa% - % - % If necessary, adjust radius so that the size requirements are - % met: - % - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@x<.5\pgf@xb% - \pgf@x=.5\pgf@xb% - \fi% - \ifdim\pgf@x<.5\pgf@yb% - \pgf@x=.5\pgf@yb% - \fi% - }% - - \saveddimen\radius{% - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@xb<\pgf@yb% - \advance\pgf@x by\pgf@yb% - \else% - \advance\pgf@x by\pgf@xb% - \fi% - \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/heatmark arc rings}}% - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/heatmark arc width}+\pgfkeysvalueof{/pgf/heatmark arc sep}}% - \multiply\pgf@xa\c@pgf@counta - \advance\pgf@x\pgf@xa - }% - % - % Anchors - % - \inheritanchor[from=circle]{north} - \inheritanchor[from=circle]{north west} - \inheritanchor[from=circle]{north east} - \inheritanchor[from=circle]{center} - \inheritanchor[from=circle]{west} - \inheritanchor[from=circle]{east} - \inheritanchor[from=circle]{mid} - \inheritanchor[from=circle]{mid west} - \inheritanchor[from=circle]{mid east} - \inheritanchor[from=circle]{base} - \inheritanchor[from=circle]{base west} - \inheritanchor[from=circle]{base east} - \inheritanchor[from=circle]{south} - \inheritanchor[from=circle]{south west} - \inheritanchor[from=circle]{south east} - \inheritanchorborder[from=circle] - % - % Background path - % - \backgroundpath{ - \pgfutil@tempdima=\innerradius% - \pgfpathcircle{\centerpoint}{\pgfutil@tempdima}% - }% - % - % - % - \behindbackgroundpath{% - \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/heatmark arc rings}}% heat arc rings - \pgfmathsetcount\c@pgf@countb{\pgfkeysvalueof{/pgf/heatmark arcs}}% heat arcs - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/heatmark arc width}}% heat arc width - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/heatmark arc sep}}% heat arc sep - %\pgfmathsetmacro\pgf@tempa{\pgfkeysvalueof{/pgf/heat arc sep angle}}% heat arc sep angle - \pgfmathsetmacro\pgf@tempb{360/\c@pgf@countb-(\pgfkeysvalueof{/pgf/heatmark arc sep angle})}% heat arc - \pgfmathsetmacro\pgf@tempc{\pgfkeysvalueof{/pgf/shape border rotate}}% heat rotate - % - \pgfmathsetmacro\pgf@tempd{\pgfkeysvalueof{/pgf/heatmark inner opacity}}% heat opacity high - \ifnum\c@pgf@counta=1 - \def\tikzext@heatmark@opacity@seps{0}% - \else - \pgfmathsetmacro\tikzext@heatmark@opacity@seps - {(\pgf@tempd-(\pgfkeysvalueof{/pgf/heatmark outer opacity}))% - /(\c@pgf@counta-1)}% - \fi - \pgfutil@tempcnta=0 - \pgfutil@tempcntb=0 - \pgf@ya\innerradius\relax - \pgftransformshift{\centerpoint} - \pgfutil@loop % ring loop - \advance\pgf@ya\pgf@xb % current radius + heat arc sep - \pgf@yb\pgf@ya - \advance\pgf@yb\pgf@xa % current radius + heat arc sep + heat arc width - \pgfsetfillopacity{\pgf@tempd}% - \begingroup - \edef\pgf@marshal{\noexpand\pgfset{heatmark ring \the\numexpr\pgfutil@tempcnta+1\relax/.try}}% - \pgf@marshal - \csname tikz@options\endcsname - {% - \pgfutil@loop - \pgfmathsetmacro\tikzext@heatmark@start@angle{\pgf@tempc-.5*\pgf@tempb+\pgfutil@tempcntb*(360/\c@pgf@countb)}% - % path - \begingroup - \edef\pgf@marshal{\noexpand\pgfset{heatmark arc \the\numexpr\pgfutil@tempcntb+1\relax/.try}% - \noexpand\pgfset{heatmark ring \the\numexpr\pgfutil@tempcnta+1\relax\space arc \the\numexpr\pgfutil@tempcntb+1\relax/.try}}% - \pgf@marshal - \csname tikz@options\endcsname - \pgfpathmoveto{\pgfpointpolar{\tikzext@heatmark@start@angle}{\pgf@ya}}% - \pgfpatharc{\tikzext@heatmark@start@angle}{\tikzext@heatmark@start@angle+\pgf@tempb}{\pgf@ya}% - \pgfpathlineto{\pgfpointpolar{\tikzext@heatmark@start@angle+\pgf@tempb}{\pgf@yb}}% - \pgfpatharc{\tikzext@heatmark@start@angle+\pgf@tempb}{\tikzext@heatmark@start@angle}{\pgf@yb}% - \pgfpathclose - \pgfusepathqfill - \endgroup - \advance\pgfutil@tempcntb\@ne - \ifnum\pgfutil@tempcntb<\c@pgf@countb - \pgfutil@repeat - }% - \endgroup - \advance\pgfutil@tempcnta\@ne - \ifnum\pgfutil@tempcnta<\c@pgf@counta - \pgf@ya\pgf@yb - \pgfmathsetmacro\pgf@tempd{\pgf@tempd-\tikzext@heatmark@opacity@seps}% - \pgfutil@repeat - \pgftransformshift{\pgfqpointscale{-1}{\centerpoint}}% - } -} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.rectangleroundedcorners.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.rectangleroundedcorners.code.tex deleted file mode 100644 index 37baf7abbf..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.rectangleroundedcorners.code.tex +++ /dev/null @@ -1,318 +0,0 @@ -\pgfset{ - rectangle with rounded corners north west radius/.initial=.5\pgflinewidth, - rectangle with rounded corners north east radius/.initial=.5\pgflinewidth, - rectangle with rounded corners south west radius/.initial=.5\pgflinewidth, - rectangle with rounded corners south east radius/.initial=.5\pgflinewidth, - rectangle with rounded corners radius/.style={ - /pgf/rectangle with rounded corners north west radius={#1}, - /pgf/rectangle with rounded corners north east radius={#1}, - /pgf/rectangle with rounded corners south west radius={#1}, - /pgf/rectangle with rounded corners south east radius={#1}} -}% -\pgfdeclareshape{rectangle with rounded corners}{% - \savedmacro\rectanglewithroundedcornersparameter{% - % - % width = max(text width + 2 * inner xseps, minimum width) + 2 * outer xseps - \pgf@x=\wd\pgfnodeparttextbox - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x by 2\pgf@xc - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@x<\pgf@xc - \pgf@x=\pgf@xc - \fi - % - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/outer xsep}}% - \edef\outerxsep{\the\pgf@xc}% - \addtosavedmacro\outerxsep - \advance\pgf@x by 2\pgf@xc - \pgf@x=.5\pgf@x - \edef\halfwidth{\the\pgf@x}% - \addtosavedmacro\halfwidth - % - % height = max(text height + text depth + 2 * inner yseps, minimum height) + 2 * outer yseps - \pgf@y=\ht\pgfnodeparttextbox - \advance\pgf@y by \dp\pgfnodeparttextbox - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y by 2\pgf@yc - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<\pgf@yc - \pgf@y=\pgf@yc - \fi - % - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}% - \edef\outerysep{\the\pgf@yc}% - \addtosavedmacro\outerysep - \advance\pgf@y by 2\pgf@yc - \pgf@y=.5\pgf@y - \edef\halfheight{\the\pgf@y}% - \addtosavedmacro\halfheight - % - % \centerpoint - \pgf@x=.5\wd\pgfnodeparttextbox - \pgf@y=.5\ht\pgfnodeparttextbox - \advance\pgf@y by -.5\dp\pgfnodeparttextbox - \pgfextract@process\centerpoint{}% - \addtosavedmacro\centerpoint - % - \pgfmathsetlengthmacro\northwestradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners north west radius}} - \pgfmathsetlengthmacro\northeastradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners north east radius}} - \pgfmathsetlengthmacro\southwestradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners south west radius}} - \pgfmathsetlengthmacro\southeastradius{\pgfkeysvalueof{/pgf/rectangle with rounded corners south east radius}} - \addtosavedmacro\northwestradius - \addtosavedmacro\northeastradius - \addtosavedmacro\southwestradius - \addtosavedmacro\southeastradius - }% - \anchor{center}{% - \rectanglewithroundedcornersparameter - \centerpoint - } - \anchor{west}{% - \rectanglewithroundedcornersparameter - \centerpoint - \advance\pgf@x by -\halfwidth - } - \anchor{east}{% - \rectanglewithroundedcornersparameter - \centerpoint - \advance\pgf@x by \halfwidth - } - \anchor{north}{% - \rectanglewithroundedcornersparameter - \centerpoint - \advance\pgf@y by \halfheight - } - \anchor{south}{% - \rectanglewithroundedcornersparameter - \centerpoint - \advance\pgf@y by -\halfheight - } - \anchor{mid}{% - \rectanglewithroundedcornersparameter - \centerpoint - \pgfmathsetlength\pgf@y{+.5ex}% - } - \anchor{mid west}{% - \csname pgf@anchor@rectangle with rounded corners@west\endcsname - \pgfmathsetlength\pgf@y{+.5ex}% - } - \anchor{mid east}{% - \csname pgf@anchor@rectangle with rounded corners@east\endcsname - \pgfmathsetlength\pgf@y{+.5ex}% - } - \anchor{base}{% - \rectanglewithroundedcornersparameter - \centerpoint - \pgf@y=0pt - } - \anchor{base west}{% - \csname pgf@anchor@rectangle with rounded corners@west\endcsname - \pgf@y=0pt - } - \anchor{base east}{% - \csname pgf@anchor@rectangle with rounded corners@east\endcsname - \pgf@y=0pt - } - \anchor{north west}{% - \csname pgf@anchor@rectangle with rounded corners@north west center\endcsname - \ifdim\northwestradius=0pt - \else - \pgf@process{\pgfpointadd{}{\pgfpointpolar{135}{\northwestradius+\outerxsep and \northwestradius+\outerysep}}}% - \fi - } - \anchor{north west center}{% - \rectanglewithroundedcornersparameter - \pgf@x=-\halfwidth - \pgf@y=\halfheight - \ifdim\northwestradius=0pt - \else - \advance\pgf@x by \outerxsep - \advance\pgf@x by \northwestradius - \advance\pgf@y by -\outerysep - \advance\pgf@y by -\northwestradius - \fi - \pgf@process{\pgfpointadd{}{\centerpoint}}% - } - \anchor{north east}{% - \csname pgf@anchor@rectangle with rounded corners@north east center\endcsname - \ifdim\northeastradius=0pt - \else - \pgf@process{\pgfpointadd{}{\pgfpointpolar{45}{\northeastradius+\outerxsep and \northeastradius+\outerysep}}}% - \fi - } - \anchor{north east center}{% - \rectanglewithroundedcornersparameter - \pgf@x=\halfwidth - \pgf@y=\halfheight - \ifdim\northeastradius=0pt - \else - \advance\pgf@x by -\outerxsep - \advance\pgf@x by -\northeastradius - \advance\pgf@y by -\outerysep - \advance\pgf@y by -\northeastradius - \fi - \pgf@process{\pgfpointadd{}{\centerpoint}}% - } - \anchor{south west}{% - \csname pgf@anchor@rectangle with rounded corners@south west center\endcsname - \ifdim\southwestradius=0pt - \else - \pgf@process{\pgfpointadd{}{\pgfpointpolar{225}{\southwestradius+\outerxsep and \southwestradius+\outerysep}}}% - \fi - } - \anchor{south west center}{% - \rectanglewithroundedcornersparameter - \pgf@x=-\halfwidth - \pgf@y=-\halfheight - \ifdim\southwestradius=0pt - \else - \advance\pgf@x by \outerxsep - \advance\pgf@x by \southwestradius - \advance\pgf@y by \outerysep - \advance\pgf@y by \southwestradius - \fi - \pgf@process{\pgfpointadd{}{\centerpoint}}% - } - \anchor{south east}{% - \csname pgf@anchor@rectangle with rounded corners@south east center\endcsname - \ifdim\southeastradius=0pt - \else - \pgf@process{\pgfpointadd{}{\pgfpointpolar{315}{\southeastradius+\outerxsep and \southeastradius+\outerysep}}}% - \fi - } - \anchor{south east center}{% - \rectanglewithroundedcornersparameter - \pgf@x=\halfwidth - \pgf@y=-\halfheight - \ifdim\southeastradius=0pt - \else - \advance\pgf@x by -\outerxsep - \advance\pgf@x by -\southeastradius - \advance\pgf@y by \outerysep - \advance\pgf@y by \southeastradius - \fi - \pgf@process{\pgfpointadd{}{\centerpoint}}% - } - \anchor{below north west}{% - \csname pgf@anchor@rectangle with rounded corners@north west center\endcsname - \advance\pgf@x by -\northwestradius - \advance\pgf@x by -\outerxsep - } - \anchor{above south west}{% - \csname pgf@anchor@rectangle with rounded corners@south west center\endcsname - \advance\pgf@x by -\southwestradius - \advance\pgf@x by -\outerxsep - } - \anchor{below north east}{% - \csname pgf@anchor@rectangle with rounded corners@north east center\endcsname - \advance\pgf@x by \northeastradius - \advance\pgf@x by \outerxsep - } - \anchor{above south east}{% - \csname pgf@anchor@rectangle with rounded corners@south east center\endcsname - \advance\pgf@x by \southeastradius - \advance\pgf@x by \outerxsep - } - \anchor{right north west}{% - \csname pgf@anchor@rectangle with rounded corners@north west center\endcsname - \advance\pgf@y by \northwestradius - \advance\pgf@y by \outerysep - } - \anchor{right south west}{% - \csname pgf@anchor@rectangle with rounded corners@south west center\endcsname - \advance\pgf@y by -\southwestradius - \advance\pgf@y by -\outerysep - } - \anchor{left north east}{% - \csname pgf@anchor@rectangle with rounded corners@north east center\endcsname - \advance\pgf@y by \northeastradius - \advance\pgf@y by \outerysep - } - \anchor{left south east}{% - \csname pgf@anchor@rectangle with rounded corners@south east center\endcsname - \advance\pgf@y by -\southeastradius - \advance\pgf@y by -\outerysep - } - \backgroundpath{% - \rectanglewithroundedcornersparameter - % - \pgf@xa=\halfwidth - \advance\pgf@xa by -\outerxsep - \edef\HalfWidth{\the\pgf@xa}% - % - \pgf@ya=\halfheight - \advance\pgf@ya by -\outerysep - \edef\HalfHeight{\the\pgf@ya}% - % - \pgftransformshift{\centerpoint}% - % - \pgfpathmoveto{\pgfqpoint{\HalfWidth}{0pt}}% - \pgfpathlineto{\pgfpoint {+\HalfWidth}{\HalfHeight-\northeastradius}}% - \pgfpatharc{0}{90}{\northeastradius}% - \pgfpathlineto{\pgfpoint{-\HalfWidth+\northwestradius}{+\HalfHeight}} - \pgfpatharc{90}{180}{\northwestradius}% - \pgfpathlineto{\pgfpoint{+-\HalfWidth}{-\HalfHeight+\southwestradius}}% - \pgfpatharc{180}{270}{\southwestradius}% - \pgfpathlineto{\pgfpoint{\HalfWidth-\southeastradius}{+-\HalfHeight}}% - \pgfpatharc{270}{360}{\southeastradius}% - \pgfpathclose - \pgftransformshift{\pgfqpointscale{-1}{\centerpoint}}% - }% - \anchorborder{% - \pgfextract@process\externalpoint{}% - \ifdim\pgf@x=0pt - \ifdim\pgf@y<0pt - \csname pgf@anchor@rectangle with rounded corners@south\endcsname - \else - \csname pgf@anchor@rectangle with rounded corners@north\endcsname - \fi - \else - \ifdim\pgf@y=0pt - \ifdim\pgf@x<0pt - \csname pgf@anchor@rectangle with rounded corners@west\endcsname - \else - \csname pgf@anchor@rectangle with rounded corners@east\endcsname - \fi - \else - \rectanglewithroundedcornersparameter - \pgfmathanglebetweenpoints{\pgfpointorigin}{\externalpoint}% - \let\angle\pgfmathresult - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfextract@process\externalPoint{\pgfpointadd{}{\centerpoint}}% - \ifdim\pgf@xa<0pt - \ifdim\pgf@ya<0pt - % south west - \pgf@sh@rwrc@anchorborder{above south west}{right south west}{south west}{180}{270}{\southwestradius}% - \else - % north west - \pgf@sh@rwrc@anchorborder{right north west}{below north west}{north west}{90}{180}{\northwestradius}% - \fi - \else - \ifdim\pgf@ya<0pt - % south east - \pgf@sh@rwrc@anchorborder{left south east}{above south east}{south east}{270}{360}{\southeastradius}% - \else - % north east - \pgf@sh@rwrc@anchorborder{below north east}{left north east}{north east}{0}{90}{\northeastradius}% - \fi - \fi - \fi - \fi - } -} -\def\pgf@sh@rwrc@anchorborder#1#2#3#4#5#6{% - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rectangle with rounded corners@#1\endcsname}% - \let\angleA\pgfmathresult - \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rectangle with rounded corners@#2\endcsname}% - \let\angleB\pgfmathresult - \if\ifdim\angle pt>\angleA pt 0\else1\fi\ifdim\angle pt<\angleB pt 0\else 2\fi - \pgfmathpointintersectionoflineandarc{\externalPoint}{\centerpoint} - {\csname pgf@anchor@rectangle with rounded corners@#3 center\endcsname} - {#4}{#5}{#6+\outerxsep and #6+\outerysep}% - \else - \pgf@process{\pgfpointadd{\pgfpointborderrectangle{\externalpoint}{\pgfqpoint{\halfwidth}{\halfheight}}}{\centerpoint}}% - \fi -} - -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.superellipse.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.superellipse.code.tex deleted file mode 100644 index 9a89b5a8a6..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.superellipse.code.tex +++ /dev/null @@ -1,198 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\usepgflibrary{shapes.geometric,intersections} -\pgfset{ - superellipse x exponent/.initial=2.5, - superellipse y exponent/.initial=2.5, - superellipse step/.initial=4, - superellipse exponent/.style={/pgf/superellipse x exponent={#1},/pgf/superellipse y exponent={#1}}} - -% Evaluates the x-value of a superellipse around the center -% #1 = t (0≤t≤90) -% #2 = 2/m (x-exp) -% #3 = a (x-rad) -\pgfmathdeclarefunction{superellipsex}{3}{% - \pgfmathcos@{#1}% - \pgfmathpow@{\pgfmathresult}{#2}% - \pgfmathmultiply@{\pgfmathresult}{#3}} - -% Evaluates the y-value of a superellipse around the center -% #1 = t (0≤t≤90) -% #2 = 2/n (y-exp) -% #3 = a (y-rad) -\pgfmathdeclarefunction{superellipsey}{3}{% - \pgfmathsin@{#1}% - \pgfmathpow@{\pgfmathresult}{#2}% - \pgfmathmultiply@{\pgfmathresult}{#3}} - -% Evaluates the x- and y- value of superellipse around the center -% #1 = t (0≤t≤90) -% #2 = 2/m (x-exp) -% #3 = 2/n (y-exp) -% #4 = a (x-rad) -% #5 = b (y-rad) -\def\pgfmathsuperellipseXY#1#2#3#4#5{% - \begingroup - \pgfmathsuperellipsex@{#1}{#2}{#4}% - \let\pgfmath@temp\pgfmathresult - \pgfmathsuperellipsey@{#1}{#3}{#5}% - \edef\pgfmath@temp{\def\noexpand\pgfmathresultX{\pgfmath@temp}% - \def\noexpand\pgfmathresultY{\pgfmathresult}}% - \expandafter - \endgroup\pgfmath@temp} - -\pgfdeclareshape{superellipse}{% - \inheritsavedanchors[from=ellipse] - \inheritanchor[from=ellipse]{text}\inheritanchor[from=ellipse]{center} - \inheritanchor[from=ellipse]{mid}\inheritanchor[from=ellipse]{base} - \inheritanchor[from=ellipse]{north}\inheritanchor[from=ellipse]{south} - \inheritanchor[from=ellipse]{west}\inheritanchor[from=ellipse]{east} - \inheritanchor[from=ellipse]{mid west}\inheritanchor[from=ellipse]{base west} - \inheritanchor[from=ellipse]{mid east}\inheritanchor[from=ellipse]{base east} - \anchor{north east}{% - \pgf@process{\radius}% - \pgfmathpow@{.70710678118}{\xexponent}% - \pgf@x=\pgfmathresult\pgf@x - \pgfmathpow@{.70710678118}{\yexponent}% - \pgf@y=\pgfmathresult\pgf@y - \pgfpointadd{}{\centerpoint}% - } - \anchor{north west}{% - \pgf@process{\radius}% - \pgfmathpow@{.70710678118}{\xexponent}% - \pgf@x=-\pgfmathresult\pgf@x - \pgfmathpow@{.70710678118}{\yexponent}% - \pgf@y=\pgfmathresult\pgf@y - \pgfpointadd{}{\centerpoint}% - } - \anchor{south west}{% - \pgf@process{\radius}% - \pgfmathpow@{.70710678118}{\xexponent}% - \pgf@x=-\pgfmathresult\pgf@x - \pgfmathpow@{.70710678118}{\yexponent}% - \pgf@y=-\pgfmathresult\pgf@y - \pgfpointadd{}{\centerpoint}% - } - \anchor{south east}{% - \pgf@process{\radius}% - \pgfmathpow@{.70710678118}{\xexponent}% - \pgf@x=\pgfmathresult\pgf@x - \pgfmathpow@{.70710678118}{\yexponent}% - \pgf@y=-\pgfmathresult\pgf@y - \pgfpointadd{}{\centerpoint}% - } - \savedmacro\xexponent{% - \pgfmathreciprocal{\pgfkeysvalueof{/pgf/superellipse x exponent}}% - \pgfmathmultiply@{\pgfmathresult}{2}% - \let\xexponent\pgfmathresult - } - \savedmacro\yexponent{% - \pgfmathreciprocal{\pgfkeysvalueof{/pgf/superellipse y exponent}}% - \pgfmathmultiply@{\pgfmathresult}{2}% - \let\yexponent\pgfmathresult - } - \savedmacro\step{% - \pgfmathtruncatemacro\step{\pgfkeysvalueof{/pgf/superellipse step}}% - } - \backgroundpath{% - \pgf@process{\radius}% - \pgfmathsetmacro\xradius{\pgf@x-(\pgfkeysvalueof{/pgf/outer xsep})}% - \pgfmathsetmacro\yradius{\pgf@y-(\pgfkeysvalueof{/pgf/outer ysep})}% - \let\pgf@tempa\pgfutil@empty\let\pgf@tempb\pgfutil@empty - \let\pgf@tempc\pgfutil@empty\let\pgf@tempd\pgfutil@empty - \c@pgf@counta=\step - \pgfutil@loop - \ifnum\c@pgf@counta<90 - \pgfmathsuperellipseXY{\the\c@pgf@counta}{\xexponent}{\yexponent}{\xradius}{\yradius}% - \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{\pgfmathresultX pt}{\pgfmathresultY pt}}}% - \pgfutil@append@macrotomacro\pgf@tempa\pgf@temp - \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{-\pgfmathresultX pt}{\pgfmathresultY pt}}}% - \pgfutil@prefix@macrotomacro\pgf@tempb\pgf@temp - \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{-\pgfmathresultX pt}{-\pgfmathresultY pt}}}% - \pgfutil@append@macrotomacro\pgf@tempc\pgf@temp - \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{\pgfmathresultX pt}{-\pgfmathresultY pt}}}% - \pgfutil@prefix@macrotomacro\pgf@tempd\pgf@temp - \advance\c@pgf@counta by\step - \pgfutil@repeat - \pgftransformshift{\centerpoint}% - \pgfplothandlerclosedcurve - \pgfplotstreamstart - \pgfplotstreampoint{\pgfqpoint{\xradius pt}{0pt}}% east - \pgf@tempa - \pgfplotstreampoint{\pgfqpoint{0pt}{\yradius pt}}% north - \pgf@tempb - \pgfplotstreampoint{\pgfqpoint{-\xradius pt}{0pt}}% west - \pgf@tempc - \pgfplotstreampoint{\pgfqpoint{0pt}{-\yradius pt}}% south - \pgf@tempd - \pgfplotstreamend - \pgftransformshift{\centerpoint\pgf@x=-\pgf@x\pgf@y=-\pgf@y} - } - \anchorborder{% - \pgfextract@process\externalpoint{}% - \ifdim\pgf@x=0pt % catch special case x = 0 - \ifdim\pgf@y<0pt \pgf@anchor@superellipse@south\else\pgf@anchor@superellipse@north\fi - \else - \ifdim\pgf@y=0pt % catch special case y = 0 - \ifdim\pgf@x<0pt \pgf@anchor@superellipse@west\else\pgf@anchor@superellipse@east\fi - \else % both are not zero - % save original direction - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - % make both positive, we're not looking at one quadrant - \ifdim\pgf@xa<0pt \pgf@x=-\pgf@x\fi - \ifdim\pgf@ya<0pt \pgf@y=-\pgf@y\fi - % save that point again - \pgfextract@process\externalpoint{}% - % we need to do the calculations without any transformations - % since we're using plots and \pgfpointborderrectangle - \pgftransformreset - \pgfintersectionofpaths{% - % from center to point on rectangle that encompasses superellipse - \pgf@relevantforpicturesizefalse - \pgfpathmoveto{\pgfpointorigin}% - \pgfpathlineto{\pgfpointborderrectangle{\externalpoint}{\radius}}% - }{% - \pgf@relevantforpicturesizefalse - \pgf@process{\radius} - \edef\xradius{\pgf@sys@tonumber\pgf@x}% - \edef\yradius{\pgf@sys@tonumber\pgf@y}% - \let\pgf@tempa\pgfutil@empty - \c@pgf@counta=\step - \pgfutil@loop - \ifnum\c@pgf@counta<90 - \pgfmathsuperellipseXY{\the\c@pgf@counta}{\xexponent}{\yexponent}{\xradius}{\yradius}% - \edef\pgf@temp{\noexpand\pgfplotstreampoint{\noexpand\pgfqpoint{\pgfmathresultX pt}{\pgfmathresultY pt}}}% - \pgfutil@append@macrotomacro\pgf@tempa\pgf@temp - \advance\c@pgf@counta by\step - \pgfutil@repeat - % we're only using curveto since closedcurve - % messes with our other path - \pgfplothandlercurveto - \pgfplotstreamstart - \pgfplotstreampoint{\pgfqpoint{\xradius pt}{0pt}}% east - \pgf@tempa - \pgfplotstreampoint{\pgfqpoint{0pt}{\yradius pt}}% north - \pgfplotstreamend - }% - \ifnum\pgfintersectionsolutions>0 % only if a solution was found - \pgf@process{\pgfpointintersectionsolution{1}}% - \else % otherwise take the border on the rectangle (close enough?) - \pgf@process{\pgfpointborderrectangle{\externalpoint}{\radius}}% - \fi - \ifdim\pgf@xa<0pt \pgf@x=-\pgf@x\fi - \ifdim\pgf@ya<0pt \pgf@y=-\pgf@y\fi - \pgf@process{\pgfpointadd{}{\centerpoint}}% - \fi - \fi - } -} -\def\pgfutil@prefix@macrotomacro#1#2{% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% - #1\expandafter\expandafter\expandafter{\expandafter#2#1}} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex deleted file mode 100644 index 630a22da14..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex +++ /dev/null @@ -1,307 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\pgfutil@IfUndefined{pgfnodepartthreebox}{% - \newbox\pgfnodepartleftbox - \newbox\pgfnodepartrightbox -}{% - \let\pgfnodepartleftbox\pgfnodeparttwobox - \let\pgfnodepartrightbox\pgfnodepartthreebox -} -\pgfset{ - uncentered rectangle center yshift/.initial=, - uncentered rectangle center/@center/.initial=2, - uncentered rectangle center/.is choice, - uncentered rectangle center/real/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{0}, - uncentered rectangle center/left/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{1}, - uncentered rectangle center/text/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{2}, - uncentered rectangle center/right/.code=\pgfkeyssetvalue{/pgf/uncentered rectangle center/@center}{3}} - -\pgfdeclareshape{uncentered rectangle}{% - \nodeparts{text,left,right}% - \savedanchor\middleCenter{% - \pgf@x=.5\wd\pgfnodeparttextbox - % - \pgf@y=\dp\pgfnodeparttextbox - \ifdim\dp\pgfnodepartleftbox>\pgf@y - \pgf@y=\dp\pgfnodepartleftbox - \fi - \ifdim\dp\pgfnodepartrightbox>\pgf@y - \pgf@y=\dp\pgfnodepartrightbox - \fi - % - \pgf@ya=\ht\pgfnodeparttextbox - \ifdim\ht\pgfnodepartleftbox>\pgf@ya - \pgf@ya=\ht\pgfnodepartleftbox - \fi - \ifdim\ht\pgfnodepartrightbox>\pgf@ya - \pgf@ya=\ht\pgfnodepartrightbox - \fi - \advance\pgf@ya by -\pgf@y - \pgf@y=.5\pgf@ya - }% - \savedanchor\leftCenter{% - % y should be still the same as before - \pgf@x=-.5\wd\pgfnodepartleftbox - }% - \savedanchor\rightCenter{% - % y should be still the same as before - \pgf@x=.5\wd\pgfnodepartrightbox - \advance\pgf@x by \wd\pgfnodeparttextbox - }% - \savedanchor\realCenter{% - % y should be still the same as before - \pgf@x=-.5\wd\pgfnodepartleftbox - \advance\pgf@x by .5\wd\pgfnodeparttextbox - \advance\pgf@x by .5\wd\pgfnodepartrightbox - }% - \savedanchor\southwest{% - % total width - \pgf@xa=\wd\pgfnodepartleftbox - \advance\pgf@xa by\wd\pgfnodepartrightbox - \advance\pgf@xa by\wd\pgfnodeparttextbox - % - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@xa by 2\pgf@xc - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@xb>\pgf@xa - \pgf@xa=\pgf@xb - \fi - % left side of shape - \advance\pgf@x by -.5\pgf@xa - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \advance\pgf@x by -\pgf@xa - % - % total height - \pgf@ya=\dp\pgfnodepartleftbox - \ifdim\pgf@ya<\dp\pgfnodeparttextbox - \pgf@ya=\dp\pgfnodeparttextbox - \fi - \ifdim\pgf@ya<\dp\pgfnodepartrightbox - \pgf@ya=\dp\pgfnodepartrightbox - \fi - \pgf@yb=\ht\pgfnodepartleftbox - \ifdim\pgf@yb<\ht\pgfnodeparttextbox - \pgf@yb=\ht\pgfnodeparttextbox - \fi - \ifdim\pgf@yb<\ht\pgfnodepartrightbox - \pgf@yb=\ht\pgfnodepartrightbox - \fi - \advance\pgf@ya by \pgf@yb - % - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@ya by 2\pgf@yc - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@yb>\pgf@ya - \pgf@ya=\pgf@yb - \fi - % lower side of the shape - \advance\pgf@y by -.5\pgf@ya - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \advance\pgf@y by -\pgf@ya - }% - \savedanchor\northeast{% - % first, let's calculate the real center again: - % - \pgf@x=-.5\wd\pgfnodepartleftbox - \advance\pgf@x by .5\wd\pgfnodeparttextbox - \advance\pgf@x by .5\wd\pgfnodepartrightbox - % - \pgf@y=\dp\pgfnodeparttextbox - \ifdim\dp\pgfnodepartleftbox>\pgf@y - \pgf@y=\dp\pgfnodepartleftbox - \fi - \ifdim\dp\pgfnodepartrightbox>\pgf@y - \pgf@y=\dp\pgfnodepartrightbox - \fi - % - \pgf@ya=\ht\pgfnodeparttextbox - \ifdim\ht\pgfnodepartleftbox>\pgf@ya - \pgf@ya=\ht\pgfnodepartleftbox - \fi - \ifdim\ht\pgfnodepartrightbox>\pgf@ya - \pgf@ya=\ht\pgfnodepartrightbox - \fi - \advance\pgf@ya by -\pgf@y - \pgf@y=.5\pgf@ya - % - % now we can calculate the anchor - % total width - % - \pgf@xa=\wd\pgfnodepartleftbox - \advance\pgf@xa by\wd\pgfnodepartrightbox - \advance\pgf@xa by\wd\pgfnodeparttextbox - % - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@xa by 2\pgf@xc - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@xb>\pgf@xa - \pgf@xa=\pgf@xb - \fi - % right side of shape - \advance\pgf@x by .5\pgf@xa - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \advance\pgf@x by \pgf@xa - % - % total height - \pgf@ya=\dp\pgfnodepartleftbox - \ifdim\pgf@ya<\dp\pgfnodeparttextbox - \pgf@ya=\dp\pgfnodeparttextbox - \fi - \ifdim\pgf@ya<\dp\pgfnodepartrightbox - \pgf@ya=\dp\pgfnodepartrightbox - \fi - \pgf@yb=\ht\pgfnodepartleftbox - \ifdim\pgf@yb<\ht\pgfnodeparttextbox - \pgf@yb=\ht\pgfnodeparttextbox - \fi - \ifdim\pgf@yb<\ht\pgfnodepartrightbox - \pgf@yb=\ht\pgfnodepartrightbox - \fi - \advance\pgf@ya by \pgf@yb - % - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@ya by 2\pgf@yc - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@yb>\pgf@ya - \pgf@ya=\pgf@yb - \fi - % upper side of the shape - \advance\pgf@y by .5\pgf@ya - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \advance\pgf@y by \pgf@ya - }% - % - \anchor{center}{% - \ifcase\pgfkeysvalueof{/pgf/uncentered rectangle center/@center}\relax - \realCenter\or - \leftCenter\or - \middleCenter\or - \rightCenter\else - \realCenter - \fi - \pgfkeysgetvalue{/pgf/uncentered rectangle center yshift}\pgf@temp - \pgfutil@ifxempty\pgf@temp{% real center used - }{% calculate center - \pgfmathsetlength\pgf@y{\pgf@temp}% - }% - }% - \anchor{left} {\leftCenter \multiply\pgf@x by2 \pgf@y=0pt } - \anchor{right} {\middleCenter\multiply\pgf@x by2 \pgf@y=0pt } - \anchor{real center} {\realCenter} - \anchor{left center} {\leftCenter} - \anchor{right center}{\rightCenter} - \anchor{text center} {\middleCenter} - \anchor{south west} {\southwest} - \anchor{north east} {\northeast} - \anchor{mid}{% - \csname pgf@anchor@uncentered rectangle@center\endcsname - \pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base}{% - \csname pgf@anchor@uncentered rectangle@center\endcsname - \pgf@y=0pt }% - \anchor{left mid} {\leftCenter \pgfmathsetlength\pgf@y{+.5ex}} - \anchor{text mid} {\middleCenter\pgfmathsetlength\pgf@y{+.5ex}} - \anchor{right mid} {\rightCenter \pgfmathsetlength\pgf@y{+.5ex}} - \anchor{real mid} {\realCenter \pgfmathsetlength\pgf@y{+.5ex}} - \anchor{left base} {\leftCenter \pgf@y=0pt } - \anchor{text base} {\middleCenter\pgf@y=0pt } - \anchor{right base} {\rightCenter \pgf@y=0pt } - \anchor{real base} {\realCenter \pgf@y=0pt } - \anchor{real south} {\pgf@anchor@rectangle@south} - \anchor{real north} {\pgf@anchor@rectangle@north} - \anchor{text north} {\pgf@anchor@rectangle@north\pgf@ya=\pgf@y\middleCenter\pgf@y=\pgf@ya} - \anchor{left north} {\pgf@anchor@rectangle@north\pgf@ya=\pgf@y\leftCenter \pgf@y=\pgf@ya} - \anchor{right north}{\pgf@anchor@rectangle@north\pgf@ya=\pgf@y\rightCenter \pgf@y=\pgf@ya} - \anchor{text south} {\pgf@anchor@rectangle@south\pgf@ya=\pgf@y\middleCenter\pgf@y=\pgf@ya} - \anchor{left south} {\pgf@anchor@rectangle@south\pgf@ya=\pgf@y\leftCenter \pgf@y=\pgf@ya} - \anchor{right south}{\pgf@anchor@rectangle@south\pgf@ya=\pgf@y\rightCenter \pgf@y=\pgf@ya} - \anchor{north}{% - \pgf@anchor@rectangle@north - \pgf@ya=\pgf@y - \csname pgf@anchor@uncentered rectangle@center\endcsname - \pgf@y=\pgf@ya - } - \anchor{south}{% - \pgf@anchor@rectangle@south - \pgf@ya=\pgf@y - \csname pgf@anchor@uncentered rectangle@center\endcsname - \pgf@y=\pgf@ya - } - %\anchor{base right}{\middleCenter\pgf@xa=2\pgf@x}% TODO - \anchor{real west}{% - \pgf@process{\northeast}% - \pgf@ya=.5\pgf@y - \pgf@process{\southwest}% - \pgf@y=.5\pgf@y - \advance\pgf@y by \pgf@ya - }% - \anchor{real east}{% - \pgf@process{\southwest}% - \pgf@ya=.5\pgf@y - \pgf@process{\northeast}% - \pgf@y=.5\pgf@y - \advance\pgf@y by \pgf@ya - }% - \anchor{west}{% - \pgf@process{\southwest}% - \pgf@xa=\pgf@x - \pgf@process{\csname pgf@anchor@uncentered rectangle@center\endcsname}% - \pgf@x=\pgf@xa - }% - \anchor{east}{% - \pgf@process{\northeast}% - \pgf@xa=\pgf@x - \pgf@process{\csname pgf@anchor@uncentered rectangle@center\endcsname}% - \pgf@x=\pgf@xa - }% - \inheritanchor[from=rectangle]{south west} - \inheritanchor[from=rectangle]{north west} - \inheritanchor[from=rectangle]{south east} - \inheritanchor[from=rectangle]{north east} - \inheritanchor[from=rectangle]{mid west} - \inheritanchor[from=rectangle]{mid east} - \inheritanchor[from=rectangle]{base west} - \inheritanchor[from=rectangle]{base east} - \inheritbackgroundpath[from=rectangle] - \anchorborder{% - % xa/ya is target - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - % xc/yc is "center" - \pgf@sh@reanchor{uncentered rectangle}{center}% - \pgf@xc=\pgf@x - \pgf@yc=\pgf@y - \ifdim\pgf@xa<0pt - % left side - \southwest - \advance\pgf@x by -\pgf@xc - \advance\pgf@y by -\pgf@yc - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - \edef\pgf@marshal{% - \noexpand\pgfpointborderrectangle - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - }% - \else - % right side - \northeast - \advance\pgf@x by -\pgf@xc - \advance\pgf@y by -\pgf@yc - \edef\pgf@marshal{% - \noexpand\pgfpointborderrectangle - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - }% - \fi - \pgf@process{\pgf@marshal}% - \advance\pgf@x by\pgf@xc - \advance\pgf@y by\pgf@yc - }% -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.transformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.transformations.mirror.code.tex deleted file mode 100644 index 4d962ccb1c..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/pgflibraryext.transformations.mirror.code.tex +++ /dev/null @@ -1,96 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\def\pgftransformxmirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@xa\pgfmathresult pt\relax - \multiply\pgf@xa2 - \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% - \else - \pgftransformmirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% - \fi -} -\def\pgftransformymirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@ya\pgfmathresult pt\relax - \multiply\pgf@ya2 - \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% - \else - \edef\pgf@marshal{\noexpand\pgftransformmirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% - {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% - \pgf@marshal - \fi} -\def\pgftransformmirror#1#2{% - \pgfextract@process\pgf@tempa{#1}% - \pgfpointnormalised{\pgfpointdiff{\pgf@tempa}{#2}}% - \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x - \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x - \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y - \multiply\pgf@xa2 - \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb - \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb - \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% - \expandafter\pgf@transformcm\pgf@temp{\pgf@tempa}% - \pgftransformshift{\pgfpointscale{-1}{\pgf@tempa}}% -} - -\def\pgfqtransformmirror#1{% - \pgfpointnormalised{#1}% - \pgf@xa=\pgf@sys@tonumber\pgf@y\pgf@x - \pgf@xb=\pgf@sys@tonumber\pgf@x\pgf@x - \pgf@yb=\pgf@sys@tonumber\pgf@y\pgf@y - \multiply\pgf@xa2 - \pgf@xc=-\pgf@yb\advance\pgf@xc\pgf@xb - \pgf@yc=-\pgf@xb\advance\pgf@yc\pgf@yb - \edef\pgf@temp{{\the\pgf@xc}{+\the\pgf@xa}{+\the\pgf@xa}{+\the\pgf@yc}}% - \expandafter\pgf@transformcm\pgf@temp{\pgfpointorigin}% -} - -% Using existant transformation (shift, rotate, yscale=-1, rotate back, shift back) -\def\pgftransformxMirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@xa\pgfmathresult pt\relax - \multiply\pgf@xa2 - \pgftransformcm{-1}{0}{0}{1}{\pgfqpoint{\pgf@xa}{0pt}}% - \else - \pgftransformMirror{\pgfqpointxy{\pgfmathresult}{0}}{\pgfpointadd{\pgfqpointxy{\pgfmathresult}{0}}{\pgfqpointxy{0}{1}}}% - \fi -} -\def\pgftransformyMirror#1{ - \pgfmathparse{#1}% - \ifpgfmathunitsdeclared - \pgf@ya\pgfmathresult pt\relax - \multiply\pgf@ya2 - \pgftransformcm{1}{0}{0}{-1}{\pgfqpoint{0pt}{\pgf@ya}}% - \else - \edef\pgf@marshal{\noexpand\pgftransformMirror{\noexpand\pgfqpointxy{0}{\pgfmathresult}}% - {\noexpand\pgfpointadd{\noexpand\pgfqpointxy{0}{\pgfmathresult}}{\noexpand\pgfqpointxy{1}{0}}}}% - \pgf@marshal - \fi} - -\def\pgftransformMirror#1#2{% - \pgfextract@process\pgf@tempa{#1}% - \pgfmathanglebetweenpoints{\pgf@tempa}{#2}% - \let\pgf@temp\pgfmathresult - \pgftransformshift{\pgf@tempa}% - \pgftransformrotate{\pgf@temp}% - \pgftransformyscale{-1}% - \pgftransformrotate{-\pgf@temp}% - \pgftransformshift{\pgfqpointscale{-1}{\pgf@tempa}}% -} - -\def\pgfqtransformMirror#1{% - \pgfmathanglebetweenpoints{\pgfpointorigin}{#1}% - \let\pgf@temp\pgfmathresult - \pgftransformrotate{\pgf@temp}% - \pgftransformyscale{-1}% - \pgftransformrotate{-\pgf@temp}% -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex deleted file mode 100644 index 195ecf9414..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.calendar-plus.code.tex +++ /dev/null @@ -1,93 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\usetikzlibrary{calendar} -\pgfutil@usemodule{pgfcalendar-ext} - -% Shift between days - -\def\tikz@lib@cal@xshift{\pgfkeysvalueof{/tikz/day xshift}} -\def\tikz@lib@cal@yshift{\pgfkeysvalueof{/tikz/day yshift}} -\tikzset{day xshift/.initial=3ex,day yshift/.initial=3.5ex} - -% Shift between months - -\def\tikz@lib@cal@month@xshift{\pgfkeysvalueof{/tikz/month xshift}} -\def\tikz@lib@cal@month@yshift{\pgfkeysvalueof{/tikz/month yshift}} -\tikzset{month xshift/.initial=9ex,month yshift/.initial=9ex} - -% Internal option for storing the "width" of a calendar as a number of -% days - -\def\tikz@lib@cal@width{\pgfkeysvalueof{/tikz/tikz@lib@cal@width}} -\tikzset{tikz@lib@cal@width/.initial=1} - -% Weeks - -\def\tikzweekcode{\pgfkeysvalueof{/tikz/week code}} -\def\tikzweektext{\pgfkeysvalueof{/tikz/week text}} - -\tikzset{ - week code/.initial={% - \node[every week]{\pgfkeysvalueof{/tikz/week text}};}, - week text/.initial={\%n=}, - every week/.style=, - week label left/.style={ - every week/.append style={ - anchor=base east, - xshift=-1.25*\pgfkeysvalueof{/tikz/day xshift}}, - execute before day scope=% - \ifdate{Monday, equals=\pgfcalendarbeginiso}{\tikzweekcode}{}}} - -% -% Overwriting original \tikz@lib@cal@if@else@code -% -\def\tikz@lib@cal@if@else@code#1#2#3{% - \pgfutil@addto@macro\tikz@lib@cal@ifs{\ifdate{#1}{#2}{#3}}% - \tikz@lib@cal@scanner% -} - -% -% Overwriting original \tikz@lib@cal@stop -% -\def\tikz@lib@cal@stop{% - \pgftransformshift{\tikz@node@at}% - \expandafter\pgfcalendar\expandafter{\tikz@fig@name}{\tikz@lib@cal@start}{\tikz@lib@cal@end}% - {% - \tikz@before@day% - \scope% - \tikz@atbegin@day% - \let\pgfutil@addto@macro\pgfutil@secondoftwo - \tikz@lib@cal@ifs% - \tikzdaycode% - \tikz@atend@day% - \endscope% - \tikz@after@day% - }% - \endgroup% -} - -\def\pgfutil@addto@macro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} - -\pgfmathdeclarefunction{weeksinmonthofyear}{3}{% #1 = first weekday, #2 = month, #3 = year - \begingroup - \pgfmathlastdayinmonthofyear@{#2}{#3}% - \pgfmathadd@{#1}{\pgfmathresult}% - \pgfmathdivide@{\pgfmathresult}{7}% - \pgfmathceil@{\pgfmathresult}% - \pgfmathint@{\pgfmathresult}% - \pgfmathsmuggle\pgfmathresult - \endgroup -} -\pgfmathdeclarefunction{lastdayinmonthofyear}{2}{% #1 = month, #2 = year - \begingroup - \pgfcalendar@getlastYMX{#2}{#1}{\pgfutil@tempcnta}% - \edef\pgfmathresult{\the\pgfutil@tempcnta}% - \pgfmathsmuggle\pgfmathresult - \endgroup -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex deleted file mode 100644 index a5a982020f..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.misc.code.tex +++ /dev/null @@ -1,180 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\usepgflibrary{ext.pgfkeys-plus}% - -%% full arc -%% https://tex.stackexchange.com/a/144297/16595 -%% The postfix operator R is added to PGFmath, -%% it allows the use of angular segments. -%% full arc = 10 makes it so that -%% 1R = 36° -%% 2R = 72° -%% … -%% 10R = 360° -%% Calling the full arc key with an empty value -%% makes 1R = 1° -\pgfset{full arc/.code=% - \def\pgf@temp{#1}% - \ifx\pgfutil@empty\pgf@temp - \let\pgfmath@fullarc@factor\pgfutil@empty - \else - \pgfmathsetmacro\pgfmath@fullarc@factor{360/(#1)}% - \fi,full arc=} -\pgfmathdeclareoperator{R}{full arc}{1}{postfix}{950} -\pgfmathdeclarefunction{full arc}{1}{% - \begingroup - \pgfmath@x=#1pt\relax - \ifx\pgfmath@fullarc@factor\pgfutil@empty\else - \pgfmath@x\pgfmath@fullarc@factor\pgfmath@x - \fi - \pgfmath@returnone\pgfmath@x - \endgroup} - -%% foreach -%% http://tex.stackexchange.com/a/126418/16595 -%% instead of \foreach \var in {start, start + delta, ..., end} -%% this allows to use \foreach[use int={start to end step delta}] without(!) a list in {} -%% the values start, end and delta are evaluated by PGFmath at the start of the loop. -%% In addition to use int, there's also use float. -\newif\iftikzext@pgf@foreach@no@list -\pgfqkeys{/pgf/foreach}{ - use int/.code={% - \tikzext@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop - }, - use float/.code={% - \tikzext@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop - } -} - -\def\tikzext@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% - \tikzext@pgf@foreach@no@listtrue - #1\foreachStart{#2}% - \pgfutil@in@{step}{#3} - \ifpgfutil@in@ - \tikzext@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop - \else - \tikzext@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop - \fi - \edef\tikzext@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% -} -\def\tikzext@pgf@foreach@no@list@parse@step#1#2step#3\pgffor@stop{% - #1\foreachEnd{#2}% - #1\foreachSecond{\foreachStart+#3}% -} -\def\pgffor@vars{% manually extended, better etoolbox - \pgfutil@ifnextchar i{\pgffor@@vars@end}{% - \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] - \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% - \iftikzext@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else - \expandafter\pgfutil@secondoftwo\fi - {\tikzext@pgf@foreach@no@listfalse\pgffor@macro@list\tikzext@pgf@foreach@no@list@list} - {\pgffor@@vars}}}}}% - -%% PGFmath -%% strrepeat("x", 5) = "xxxxx" -\pgfmathdeclarefunction{strrepeat}{2}{% - \begingroup\pgfmathint{#2}\pgfmath@count\pgfmathresult - \let\pgfmathresult\pgfutil@empty - \pgfutil@loop\ifnum\pgfmath@count>0\relax - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% - \advance\pgfmath@count-1\relax - \pgfutil@repeat\pgfmath@smuggleone\pgfmathresult\endgroup} - -%% isInString("foo", "foobar") = true (= 1) -%% isInString("boo", "foobar") = false (= 0) -\pgfmathdeclarefunction{isInString}{2}{% - \pgfutil@in@{#1}{#2}% - \ifpgfutil@in@\def\pgfmathresult{1}\else\def\pgfmathresult{0}\fi} - -%% strcat("foo", "bar") = "foobar" (can have more than two parameters) -\pgfutil@IfUndefined{pgfmathstrcat@}{ - \pgfmathdeclarefunction{strcat}{...}{% - \begingroup - \let\pgfmathresult\pgfutil@empty - \pgfmathstrcat@@#1\pgfmath@stop} - \def\pgfmathstrcat@@#1{% - \ifx\pgfmath@stop#1% - \def\pgfmath@next{\pgfmath@smuggleone\pgfmathresult\endgroup} - \else - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% - \let\pgfmath@next\pgfmathstrcat@@ - \fi - \pgfmath@next} -}{} - -% http://tex.stackexchange.com/questions/244569/bounding-lines-around-tax-nodes/244619#244619 -\pgfmathdeclarefunction{atanXY}{2}{\pgfmathatantwo@{#2}{#1}} -\pgfmathdeclarefunction{atanYX}{2}{\pgfmathatantwo@{#1}{#2}} - -%% http://tex.stackexchange.com/a/132939/16595 -\tikzset{ - @edges through/.code={{{% three braces to protect \pgfeov - \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges through/.@cmd}} - {\pgfkeysvalueof{/tikz/@@edges through/.@cmd}[]}#1\pgfeov}}}, - @@edges through/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2) (#2)}}, - edges through/.style={/tikz/@edges through/.list={#1}}} -\tikzset{ - @edges to/.code={{{% three braces to protect \pgfeov - \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges to/.@cmd}} - {\pgfkeysvalueof{/tikz/@@edges to/.@cmd}[]}#1\pgfeov}}}, - @@edges to/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2)}}, - edges to/.style={/tikz/@edges to/.list={#1}}} -\tikzset{ - @tos to/.code={{{% three braces to protect \pgfeov - \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@tos to/.@cmd}} - {\pgfkeysvalueof{/tikz/@@tos to/.@cmd}[]}#1\pgfeov}}}, - @@tos to/.style args={[#1]#2}{/tikz/insert path={to[#1] (#2)}}, - tos to/.style={/tikz/@tos to/.list={#1}}} - - -\pgfmathdeclarefunction{distancebetween}{2}{% only coordinates/nodes - \begingroup - \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% - \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmathveclen@\pgfmath@temp - \pgfmath@smuggleone\pgfmathresult - \endgroup} -\pgfmathdeclarefunction{qdistancebetween}{1}{% only coordinates/nodes - \begingroup - \pgfpointdiff{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% - \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmathveclen@\pgfmath@temp - \pgfmath@smuggleone\pgfmathresult - \endgroup} - -\pgfmathdeclarefunction{qanglebetween}{1}{% - \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}} - -\pgfmathdeclarefunction{anglebetween}{2}{% - \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}} - -\pgfmathdeclarefunction{isEmpty}{1}{% - \begingroup - \def\pgfmath@temp{#1}% - \pgfutil@ifxempty\pgfmath@temp{\def\pgfmathresult{1}}{\def\pgfmathresult{0}}% - \pgfmath@smuggleone\pgfmathresult - \endgroup} - -\pgfset{ - declare constant/.code={% - \let\pgfmathdeclareconstant@@@\pgfutil@empty - \pgfkeysvalueof{/pgf/declare function/execute at begin function}% - \pgfmathdeclareconstant@#1@=@;\pgf@stop - \pgfkeysvalueof{/pgf/declare function/execute at end function}% - \pgfmathdeclareconstant@@@ - }} -\def\pgfmathdeclareconstant@{% - \pgfutil@ifnextchar x\pgfmathdeclareconstant@@\pgfmathdeclareconstant@@ -} -\def\pgfmathdeclareconstant@@#1=#2;#3\pgf@stop{% - \edef\pgfmath@local@temp{#1}% - \pgfutil@ifx\pgfmath@local@temp\pgfmath@local@at{}{% - \pgfutil@g@addto@macro\pgfmathdeclareconstant@@@{\pgfmathdeclarepseudoconstant{#1}{\def\pgfmathresult{#2}}}% - \pgfmathdeclareconstant@#3\pgf@stop - }% -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex deleted file mode 100644 index c0ecda441a..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.code.tex +++ /dev/null @@ -1,339 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\def\tikzext@nf@align@left#1{} -\def\tikzext@nf@align@center#1{\kern.5#1} -\def\tikzext@nf@align@right#1{\kern#1} - -\pgfqkeys{/tikz/node family}{ - width/.initial=, - width/.append style={/pgf/minimum width=nf_width}, - height/.initial=, - height/.append style={/pgf/minimum height=nf_height}, - size/.code=\pgfqkeys{/tikz/node family}{width={#1},height={#1}}, - text depth/.initial=, - text height/.initial=, - text width align/.is choice, - text width align/left/.code=\let\tikzext@nf@align@action\tikzext@nf@align@left, - text width align/center/.code=\let\tikzext@nf@align@action\tikzext@nf@align@center, - text width align/right/.code=\let\tikzext@nf@align@action\tikzext@nf@align@right, - text width align=center, - text width/.initial=, - text/.code=\pgfqkeys{/tikz/node family}{text depth={#1},text height={#1},text width={#1}}, - prefix/.initial=\pgfpictureid-, -} -\tikzset{node family/.code=\pgfqkeys{/tikz/node family}{#1}} - -% #1 = family type + name -\def\tikzext@nf@save#1{% - %\errmessage{#1}% - \immediate\write\pgfutil@auxout{% - \noexpand\expandafter\noexpand\gdef\noexpand\csname tikzext@nf@#1@previous\endcsname - {\csname tikzext@nf@#1@next\endcsname}% - }% -} - -% #1 = value to set -% #2 = family type -% #3 = return dimen -\def\tikzext@nf@getandset#1#2#3{% - % what's our family's name? - #3=0pt\relax - \pgfkeysgetvalue{/tikz/node family/#2}\tikzext@nf@familyname - \pgfutil@ifxempty\tikzext@nf@familyname{% no family to deal with - }{% - \edef\tikzext@nf@familyname{\pgfkeysvalueof{/tikz/node family/prefix}\tikzext@nf@familyname}% - % we need to save the value for the next run - \pgfutil@IfUndefined{tikzext@nf@#2@\tikzext@nf@familyname @next}{% - % first time: define first value and install hook at end of picture - \expandafter\xdef\csname tikzext@nf@#2@\tikzext@nf@familyname @next\endcsname{#1}% - \edef\tikz@temp{\noexpand\tikzext@nf@save{#2@\tikzext@nf@familyname}}% - %\expandafter\AtVeryEndDocument\expandafter{\tikz@temp}% - \expandafter\pgfutil@g@addto@macro\expandafter\tikz@atend@picture\expandafter{\tikz@temp}% - }{% - \ifdim\csname tikzext@nf@#2@\tikzext@nf@familyname @next\endcsname<#1\relax - \expandafter\xdef\csname tikzext@nf@#2@\tikzext@nf@familyname @next\endcsname{#1}% - \fi - }% - \pgfutil@IfUndefined{tikzext@nf@#2@\tikzext@nf@familyname @previous}{% first run, ignore - }{% set previous value - #3=\csname tikzext@nf@#2@\tikzext@nf@familyname @previous\endcsname\relax - }% - }% -} - -\pgfdeclareshape{Rectangle}{% - \savedanchor\northeast{% - % Calculate x - % - % First, is width < minimum width? - \pgf@x=\the\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x by 2\pgf@xc% - % Qrr: family width - \tikzext@nf@getandset{\the\pgf@x}{width}{\pgfutil@tempdima}% - \ifdim\pgf@x<\pgfutil@tempdima - \pgf@x=\pgfutil@tempdima - \fi - % - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@x<\pgf@xb% - % yes, too small. Enlarge... - \pgf@x=\pgf@xb% - \fi% - % Now, calculate right border: .5\wd\pgfnodeparttextbox + .5 \pgf@x + outer sep - \pgf@x=.5\pgf@x% - \advance\pgf@x by.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \advance\pgf@x by\pgf@xa% - % Calculate y - % - % First, is height+depth < minimum height? - \pgf@y=\ht\pgfnodeparttextbox% - \advance\pgf@y by\dp\pgfnodeparttextbox% - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y by 2\pgf@yc% - % Qrr: family height - \tikzext@nf@getandset{\the\pgf@y}{height}{\pgfutil@tempdima}% - \ifdim\pgf@y<\pgfutil@tempdima - \pgf@y=\pgfutil@tempdima - \fi - % - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<\pgf@yb% - % yes, too small. Enlarge... - \pgf@y=\pgf@yb% - \fi% - % Now, calculate upper border: .5\ht-.5\dp + .5 \pgf@y + outer sep - \pgf@y=.5\pgf@y% - \advance\pgf@y by-.5\dp\pgfnodeparttextbox% - \advance\pgf@y by.5\ht\pgfnodeparttextbox% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \advance\pgf@y by\pgf@ya% - }% - - \savedanchor\southwest{% - % Calculate x - % - % First, is width < minimum width? - \pgf@x=\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@x by 2\pgf@xc% - % Qrr: family width - \tikzext@nf@getandset{\the\pgf@x}{width}{\pgfutil@tempdima}% - \ifdim\pgf@x<\pgfutil@tempdima - \pgf@x=\pgfutil@tempdima - \fi - % - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% - \ifdim\pgf@x<\pgf@xb% - % yes, too small. Enlarge... - \pgf@x=\pgf@xb% - \fi% - % Now, calculate left border: .5\wd\pgfnodeparttextbox - .5 \pgf@x - outer sep - \pgf@x=-.5\pgf@x% - \advance\pgf@x by.5\wd\pgfnodeparttextbox% - \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% - \advance\pgf@x by-\pgf@xa% - % Calculate y - % - % First, is height+depth < minimum height? - \pgf@y=\ht\pgfnodeparttextbox% - \advance\pgf@y by\dp\pgfnodeparttextbox% - \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@y by 2\pgf@yc% - % Qrr: family height - \tikzext@nf@getandset{\the\pgf@y}{height}{\pgfutil@tempdima}% - \ifdim\pgf@y<\pgfutil@tempdima - \pgf@y=\pgfutil@tempdima - \fi - % - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@y<\pgf@yb% - % yes, too small. Enlarge... - \pgf@y=\pgf@yb% - \fi% - % Now, calculate upper border: .5\ht-.5\dp - .5 \pgf@y - outer sep - \pgf@y=-.5\pgf@y% - \advance\pgf@y by-.5\dp\pgfnodeparttextbox% - \advance\pgf@y by.5\ht\pgfnodeparttextbox% - \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% - \advance\pgf@y by-\pgf@ya% - }% - \inheritbackgroundpath[from=rectangle] - \inheritbeforebackgroundpath[from=rectangle] - \inheritbehindforegroundpath[from=rectangle] - \inheritforegroundpath[from=rectangle] - \inheritbeforeforegroundpath[from=rectangle] - \inheritanchor[from=rectangle]{center} - \inheritanchor[from=rectangle]{mid} - \inheritanchor[from=rectangle]{base} - \inheritanchor[from=rectangle]{north} - \inheritanchor[from=rectangle]{south} - \inheritanchor[from=rectangle]{west} - \inheritanchor[from=rectangle]{mid west} - \inheritanchor[from=rectangle]{base west} - \inheritanchor[from=rectangle]{north west} - \inheritanchor[from=rectangle]{south west} - \inheritanchor[from=rectangle]{east} - \inheritanchor[from=rectangle]{mid east} - \inheritanchor[from=rectangle]{base east} - \inheritanchor[from=rectangle]{north east} - \inheritanchor[from=rectangle]{south east} - \inheritanchorborder[from=rectangle] -} - -\pgfdeclareshape{Circle}{% - \savedanchor\centerpoint{% tex/generic/pgf/modules/pgfmoduleshapes.code.tex - \pgf@x=.5\wd\pgfnodeparttextbox - \pgf@y=.5\ht\pgfnodeparttextbox - \advance\pgf@y by-.5\dp\pgfnodeparttextbox - }% - \saveddimen\radius{% tex/generic/pgf/modules/pgfmoduleshapes.code.tex - % Calculate ``height radius'' - \pgf@ya=.5\ht\pgfnodeparttextbox - \advance\pgf@ya by.5\dp\pgfnodeparttextbox - \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% - \advance\pgf@ya by\pgf@yb - % Calculate ``width radius'' - \pgf@xa=.5\wd\pgfnodeparttextbox - \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% - \advance\pgf@xa by\pgf@xb - % Calculate length of radius vector: - \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% - \ifdim\pgf@x>\pgf@y - \c@pgf@counta=\pgf@x - \ifnum\c@pgf@counta=0\relax - \else - \divide\c@pgf@counta by 255\relax - \pgf@xa=16\pgf@xa\relax - \divide\pgf@xa by\c@pgf@counta - \pgf@xa=16\pgf@xa\relax - \fi - \else - \c@pgf@counta=\pgf@y - \ifnum\c@pgf@counta=0\relax - \else - \divide\c@pgf@counta by 255\relax - \pgf@ya=16\pgf@ya\relax - \divide\pgf@ya by\c@pgf@counta - \pgf@xa=16\pgf@ya\relax - \fi - \fi - \pgf@x=\pgf@xa% - % Qrr: check for families - \tikzext@nf@getandset{\the\dimexpr2\pgf@x\relax}{width}{\pgfutil@tempdima}% - \tikzext@nf@getandset{\the\dimexpr2\pgf@x\relax}{height}{\pgfutil@tempdimb}% - % Qrr: and adjust like minimum width and minimum height - \ifdim\pgf@x<.5\pgfutil@tempdima - \pgf@x=.5\pgfutil@tempdima - \fi - \ifdim\pgf@x<.5\pgfutil@tempdimb - \pgf@x=.5\pgfutil@tempdimb - \fi - % If necessary, adjust radius so that the size requirements are met: - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% - \ifdim\pgf@x<.5\pgf@xb - \pgf@x=.5\pgf@xb - \fi - \ifdim\pgf@x<.5\pgf@yb - \pgf@x=.5\pgf@yb - \fi - % Now, add larger of outer separations. - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% - \ifdim\pgf@xb<\pgf@yb - \advance\pgf@x by\pgf@yb - \else - \advance\pgf@x by\pgf@xb - \fi - }% - \inheritbackgroundpath[from=circle] - \inheritbeforebackgroundpath[from=circle] - \inheritbehindforegroundpath[from=circle] - \inheritforegroundpath[from=circle] - \inheritbeforeforegroundpath[from=circle] - \inheritanchor[from=circle]{center} - \inheritanchor[from=circle]{mid} - \inheritanchor[from=circle]{base} - \inheritanchor[from=circle]{north} - \inheritanchor[from=circle]{south} - \inheritanchor[from=circle]{west} - \inheritanchor[from=circle]{mid west} - \inheritanchor[from=circle]{base west} - \inheritanchor[from=circle]{north west} - \inheritanchor[from=circle]{south west} - \inheritanchor[from=circle]{east} - \inheritanchor[from=circle]{mid east} - \inheritanchor[from=circle]{base east} - \inheritanchor[from=circle]{north east} - \inheritanchor[from=circle]{south east} - \inheritanchorborder[from=circle] -} - -\def\pgfutil@prefixto@macro#1#2{% - \def\pgf@temp{#2}% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter#1% - \expandafter\expandafter\expandafter{\expandafter\pgf@temp#1}% -} - -\pgfqkeys{/tikz/node family}{ - setup shape/.code={% - \expandafter\pgfutil@prefixto@macro\csname pgf@sh@s@#1\endcsname{% - \tikzext@nf@getandset{\the\wd\pgfnodeparttextbox}{text width}{\pgfutil@tempdima}% - \ifdim\wd\pgfnodeparttextbox<\pgfutil@tempdima - \pgfutil@tempdimb=\pgfutil@tempdima - \advance\pgfutil@tempdimb-\wd\pgfnodeparttextbox - \setbox\pgfnodeparttextbox=\hbox to \pgfutil@tempdima{\tikzext@nf@align@action\pgfutil@tempdimb\unhbox\pgfnodeparttextbox}% - \fi - \tikzext@nf@getandset{\the\dp\pgfnodeparttextbox}{text depth}{\pgfutil@tempdima}% - \ifdim\dp\pgfnodeparttextbox<\pgfutil@tempdima - \dp\pgfnodeparttextbox=\pgfutil@tempdima - \fi - \tikzext@nf@getandset{\the\ht\pgfnodeparttextbox}{text height}{\pgfutil@tempdima}% - \ifdim\ht\pgfnodeparttextbox<\pgfutil@tempdima - \ht\pgfnodeparttextbox=\pgfutil@tempdima - \fi - }% - }, - setup shape/.list={rectangle,circle,Rectangle,Circle} -} - -%% nf functions -\def\tikzext@nf@function@default{{\the\pgf@x}{\the\pgf@y}} -\def\tikzext@nf@function@default@double{{\the\dimexpr2\pgf@x\relax}{\the\dimexpr2\pgf@y\relax}} -\def\tikzext@nf@function@circle{{\the\pgf@x}{\the\pgf@x}} -\def\tikzext@nf@function@circle@double{{\the\dimexpr2\pgf@x\relax}{\the\dimexpr2\pgf@x\relax}} - -\pgfmathdeclarefunction{nf_width}{0}{% - \begingroup - \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name}{% - \let\tikzext@nf@function\tikzext@nf@function@default - }{% - \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name @extra}{}{\csname tikzext@nf@function@\pgf@sm@shape@name @extra\endcsname}% - \expandafter\let\expandafter\tikzext@nf@function\csname tikzext@nf@function@\pgf@sm@shape@name\endcsname - }% - \tikzext@nf@getandset{\expandafter\pgfutil@firstoftwo\tikzext@nf@function}{width}{\pgfutil@tempdima}% - \edef\pgfmathresult{\pgf@sys@tonumber\pgfutil@tempdima}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -\pgfmathdeclarefunction{nf_height}{0}{% - \begingroup - \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name}{% - \let\tikzext@nf@function\tikzext@nf@function@default - }{% - \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name @extra}{}{\csname tikzext@nf@function@\pgf@sm@shape@name @extra\endcsname}% - \expandafter\let\expandafter\tikzext@nf@function\csname tikzext@nf@function@\pgf@sm@shape@name\endcsname - }% - \tikzext@nf@getandset{\expandafter\pgfutil@secondoftwo\tikzext@nf@function}{height}{\pgfutil@tempdima}% - \edef\pgfmathresult{\pgf@sys@tonumber\pgfutil@tempdima}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.shapes.geometric.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.shapes.geometric.code.tex deleted file mode 100644 index 58384960a8..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.node-families.shapes.geometric.code.tex +++ /dev/null @@ -1,38 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\usetikzlibrary{ext.node-families,shapes.geometric} - -\let\tikzext@nf@function@ellipse \tikzext@nf@function@default@double -\let\tikzext@nf@function@star \tikzext@nf@function@circle -\let\tikzext@nf@function@diamond \tikzext@nf@function@default@double -\let\tikzext@nf@function@star \tikzext@nf@function@circle@double -\expandafter\let\csname tikzext@nf@function@regular polygon\endcsname - \tikzext@nf@function@circle@double -\let\tikzext@nf@function@trapezium\tikzext@nf@function@default@double -\def\tikzext@nf@function@semicircle {{\the\dimexpr2\pgf@x\relax}{\the\pgf@x}} -\expandafter\def\csname tikzext@nf@function@isosceles triangle\endcsname - {{\the\dimexpr2\pgf@ya\relax}{\the\pgf@xa}} -\def\tikzext@nf@function@kite {{\the\dimexpr2\pgf@xa\relax}{\the\dimexpr\pgf@ya+\pgf@yb\relax}} -\def\tikzext@nf@function@dart {{\the\dimexpr2\pgf@ya\relax}{\the\pgf@xb}} -\expandafter\def\csname tikzext@nf@function@circular sector\endcsname{{\the\pgf@xc}{\the\pgf@xa}} -\def\tikzext@nf@function@cylinder{{\the\dimexpr2\pgfutil@tempdimb\relax}{\the\pgf@x}} - -\tikzset{node family/setup shape/.list={ - ellipse, - star, - diamond, - regular polygon, - trapezium, - semicircle, - isosceles triangle, - kite, - dart, - circular sector, - cylinder -}} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.arcto.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.arcto.code.tex deleted file mode 100644 index e97bbf939d..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.arcto.code.tex +++ /dev/null @@ -1,326 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\tikzset{ - arc to/.code=\pgfqkeys{/tikz/arc to}{#1}, - arc to={ - counter clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{1}, - clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{0}, - x radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}, - y radius/.code=\pgfkeyssetvalue{/tikz/y radius}{#1}, - radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}\pgfkeyssetvalue{/tikz/y radius}{#1}, - large/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{1}, - small/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{0}, - % defaults - rotate/.initial=0, counter clockwise, small, - counter clockwise/.value forbidden, - clockwise/.value forbidden, - large/.value forbidden, - small/.value forbidden}} -\def\tikz@arcA rc{\pgfutil@ifnextchar t% - {\tikz@flush@moveto\expandafter\expandafter\expandafter\tikz@arcB@cont\expandafter\pgfutil@gobble\pgfutil@gobble} - {\tikz@flush@moveto\tikz@arc@cont}} -\def\tikz@arcB@cont{% - \pgfutil@ifnextchar[\tikz@@do@arcB{ - \advance\tikz@expandcount by -10\relax% go down quickly - \ifnum\tikz@expandcount<0\relax% - \def\@next{\tikz@@do@arcB[]}% - \else% - \def\@next{\expandafter\tikz@arcB@cont}% - \fi% - \@next}}% -\def\tikz@@do@arcB[#1]{% - \def\tikz@arcB@options{#1}% - \tikz@do@@arcB} -\def\tikz@do@@arcB{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@do@@arcB} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@do@@arcB} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikz@do@@arcB} - {\tikz@scan@one@point\tikz@do@arcB}}}} - -\def\tikz@do@arcB#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} - \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \iftikz@shapeborder - \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% - \fi - \begingroup - \tikzset{every arc/.try,every arc to/.try,arc to/.expand once=\tikz@arcB@options}% - \pgfmathsetmacro\tikz@arc@x{\pgfkeysvalueof{/tikz/x radius}}% - \ifpgfmathunitsdeclared - \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% - \ifpgfmathunitsdeclared - \tikzext@pgfpatharcto{\tikz@arc@x pt}{\tikz@arc@y pt} - {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} - {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% - \else - \tikzerror{You cannot mix dimensions and dimension values in an arc}% - \fi - \else - \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% - \ifpgfmathunitsdeclared - \tikzerror{You cannot mix dimensions and dimension values in an arc}% - \else - \pgf@process{\pgfpointxy{\tikz@arc@x}{0}}% - \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% - \let\tikz@arc@x\pgfmathresult - \pgf@process{\pgfpointxy{0}{\tikz@arc@y}}% - \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% - \let\tikz@arc@y\pgfmathresult - \tikzext@pgfpatharcto{+\tikz@arc@x pt}{+\tikz@arc@y pt} - {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} - {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% - \fi - \fi - \endgroup - % check whether \pgf@marshall starts with \pgfpathlineto - \pgfutil@ifxempty\pgf@marshal{}{% - \edef\tikz@temp{\expandafter\expandafter\expandafter\noexpand\expandafter\pgfutil@firstgobblerest\pgf@marshal\relax}% - \expandafter\let\expandafter\tikz@temp\tikz@temp - \pgfutil@ifx\tikz@temp\pgfpathlineto{}{% - % getting rid of \pgfpatharcaxes inside \pgf@marshal - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@marshal - \expandafter\expandafter\expandafter{\expandafter\pgfutil@gobble\pgf@marshal}% - % extracting the other four values needed for the timer - \edef\tikz@timer@start@angle{\expandafter\pgfutil@firstoffour\pgf@marshal}% - \edef\tikz@timer@end@angle{\expandafter\pgfutil@secondoffour\pgf@marshal}% - \pgfextract@process\tikz@timer@zero@axis{\expandafter\pgfutil@thirdoffour\pgf@marshal}% - \pgfextract@process\tikz@timer@ninety@axis{\expandafter\pgfutil@fourthoffour\pgf@marshal}% - % - \let\tikz@timer=\tikz@timer@arc - }% - }% - \tikz@scan@next@command -} -\def\pgfutil@firstoffour#1#2#3#4{#1} -\def\pgfutil@secondoffour#1#2#3#4{#2} -\def\pgfutil@thirdoffour#1#2#3#4{#3} -\def\pgfutil@fourthoffour#1#2#3#4{#4} -\def\pgfutil@firstgobblerest#1#2\relax{#1} - -% original from pgfcorepathconstruct.code.tex -\def\tikzext@pgfpatharcto#1#2#3#4#5#6{% - {% - % The following code is based on the transformation described in svg - % 1.1 specification Section F.6.5 - % - % Step 1: store the simple parameters (xa=x1 since TeX does not - % allow numbers in names) - % - \pgfmathsetmacro\pgf@arcto@rx{abs(#1)}% - \pgfmathsetmacro\pgf@arcto@ry{abs(#2)}% - \ifdim\pgf@arcto@rx pt=0pt% special rule: zero radius=straight line - \gdef\pgf@marshal{\pgfpathlineto{#6}}% - \else - \ifdim\pgf@arcto@ry pt=0pt% special rule: zero radius=straight line - \gdef\pgf@marshal{\pgfpathlineto{#6}}% - \else - \pgfmathsetmacro\pgf@arcto@phi{#3}% - \pgfmathsetmacro\pgf@arcto@fA{#4}% - \ifdim\pgf@arcto@fA pt=0pt - \else - \pgfmathsetmacro\pgf@arcto@fA{1.0}% Special rule: every non-zero value is 1. - \fi - \pgfmathsetmacro\pgf@arcto@fS{#5}% - \ifdim\pgf@arcto@fS pt=0pt - \else - \pgfmathsetmacro\pgf@arcto@fS{1.0}% Special rule: every non-zero value is 1. - \fi - \pgf@process{#6}% - \edef\pgf@arcto@xb{\the\pgf@x}% - \edef\pgf@arcto@yb{\the\pgf@y}% - % - % Step 2: x1,y1 is more complicated to compute: It is given by lastx - % and lasty, but these are transformed coordinates, we need the - % untransformed ones. So, we inverse the transformation (arghh...) - % - \pgftransforminvert% - \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}}% - \edef\pgf@arcto@xa{\the\pgf@x}% - \edef\pgf@arcto@ya{\the\pgf@y}% - \edef\pgf@temp@a{\pgf@arcto@xa,\pgf@arcto@ya}% - \edef\pgf@temp@b{\pgf@arcto@xb,\pgf@arcto@yb}% - \ifx\pgf@temp@a\pgf@temp@b% special rule: skip! - \global\let\pgf@marshal\pgfutil@empty - \else - % - % Ok, now we got all the parameters setup. Now comes the - % computation... - % - % - % Step 3: Start with a new coordinate system and rotate everything - % by the negated phi. - % - \pgftransformreset - \pgftransformrotate{-\pgf@arcto@phi}% - % Ok, using \pgfpointtransformed we now get transformed points... - % - % Step 4: Compute x1' and y1' (xaprime and yaprime) - % - \pgf@process{% - \pgfpointtransformed{\pgfpointscale{.5}{\pgfpointdiff - {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}} - {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}}% - }% - }% - }% - \edef\pgf@arcto@xaprime{\pgf@sys@tonumber\pgf@x}% - \edef\pgf@arcto@yaprime{\pgf@sys@tonumber\pgf@y}% - % - % Compute Lambda - % - \pgfmathsetmacro\pgf@arcto@frac@x{\pgf@arcto@xaprime/\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@frac@y{\pgf@arcto@yaprime/\pgf@arcto@ry}% - \pgfmathsetmacro\pgf@arcto@lambda{ - \pgf@arcto@frac@x*\pgf@arcto@frac@x+\pgf@arcto@frac@y*\pgf@arcto@frac@y - }% - \ifdim\pgf@arcto@lambda pt>1pt - \pgfmathsetmacro\pgf@arcto@sqrt@lambda{sqrt(\pgf@arcto@lambda)}% - \pgfmathsetmacro\pgf@arcto@rx{\pgf@arcto@sqrt@lambda*\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@ry{\pgf@arcto@sqrt@lambda*\pgf@arcto@ry}% - \fi - % - % Do some scaling - % - \pgfmathsetmacro\pgf@arcto@xaprime@abs{abs(\pgf@arcto@xaprime)}% - \pgfmathsetmacro\pgf@arcto@yaprime@abs{abs(\pgf@arcto@yaprime)}% - \pgfmathmax@{\pgf@arcto@rx,\pgf@arcto@ry,\pgf@arcto@xaprime@abs,\pgf@arcto@yaprime@abs}% - \pgfmathsetmacro\pgf@arcto@scaling{20/\pgfmathresult}% - \pgfmathsetmacro\pgf@arcto@rx@scaled{\pgf@arcto@scaling*\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@ry@scaled{\pgf@arcto@scaling*\pgf@arcto@ry}% - \pgfmathsetmacro\pgf@arcto@xaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@xaprime}% - \pgfmathsetmacro\pgf@arcto@yaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@yaprime}% - % - % Step 5: Now comes the messy computation of c1' and c2'. - % - \ifdim\pgf@arcto@rx pt>\pgf@arcto@ry pt - \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry}% - \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime@scaled}% - \pgfmathsetmacro\pgf@arcto@numerator{ - \pgf@arcto@ry@scaled*\pgf@arcto@ry@scaled- - \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled- - \pgf@arcto@temp*\pgf@arcto@temp - }% - \pgfmathsetmacro\pgf@arcto@denominator{ - \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled+ - \pgf@arcto@temp*\pgf@arcto@temp - }% - \else - \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry}% - \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime@scaled}% - \pgfmathsetmacro\pgf@arcto@numerator{ - \pgf@arcto@rx@scaled*\pgf@arcto@rx@scaled- - \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled- - \pgf@arcto@temp*\pgf@arcto@temp - }% - \pgfmathsetmacro\pgf@arcto@denominator{ - \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled+ - \pgf@arcto@temp*\pgf@arcto@temp - }% - \fi - \pgfmathsetmacro\pgf@arcto@frac{ - \pgf@arcto@numerator/\pgf@arcto@denominator - }% - \ifdim\pgf@arcto@frac pt<0pt - \pgfmathsetmacro\pgf@arcto@factor{0}% - \else - \pgfmathsetmacro\pgf@arcto@factor{sqrt(\pgf@arcto@frac)}% - \fi - \ifx\pgf@arcto@fA\pgf@arcto@fS - \pgfmathsetmacro\pgf@arcto@factor{-\pgf@arcto@factor}% - \fi - \pgfmathsetmacro\pgf@arcto@cxprime{ - \pgf@arcto@factor*\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime - }% - \pgfmathsetmacro\pgf@arcto@cyprime{ - -\pgf@arcto@factor*\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime - }% - % - % Step 6: Ok, now compute cx,cy - % - \pgftransformreset - \pgftransformrotate{\pgf@arcto@phi}% - \pgf@process{% - \pgfpointtransformed{\pgfqpoint{\pgf@arcto@cxprime pt}{\pgf@arcto@cyprime pt}}% - }% - \edef\pgf@arcto@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \pgf@process{\pgfpointadd{\pgf@arcto@temp}{% - \pgfpointscale{.5}{% - \pgfpointadd - {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}} - {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}}}% - }% - }% - \edef\pgf@arcto@cx{\the\pgf@x}% - \edef\pgf@arcto@cy{\the\pgf@y}% - % - % Step 7: Compute start angle: - % - \pgfmathsetmacro\pgf@arcto@vec@x{(\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@vec@y{(\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry}% - \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)}% - \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator}% - \pgfmathsetmacro\pgf@arcto@theta@start{acos(\pgf@arcto@frac)}% - \ifdim\pgf@arcto@vec@y pt<0pt - \pgfmathsetmacro\pgf@arcto@theta@start{-\pgf@arcto@theta@start}% - \fi - % - % Step 8: Compute end angle: - % - \pgfmathsetmacro\pgf@arcto@vec@x{(-\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx}% - \pgfmathsetmacro\pgf@arcto@vec@y{(-\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry}% - \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)}% - \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator}% - \pgfmathsetmacro\pgf@arcto@theta@end{acos(\pgf@arcto@frac)}% - \ifdim\pgf@arcto@vec@y pt<0pt - \pgfmathsetmacro\pgf@arcto@theta@end{-\pgf@arcto@theta@end}% - \fi - \pgfmathsetmacro\pgf@arcto@delta@theta{abs(\pgf@arcto@theta@start-\pgf@arcto@theta@end)}% - \ifdim\pgf@arcto@fA pt=0pt - \ifdim\pgf@arcto@delta@theta pt>180pt - % Ok, we need to adjust the angle! - \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt - \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}% - \else - \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}% - \fi - \fi - \else - \ifdim\pgf@arcto@delta@theta pt<180pt - % Ok, we need to adjust the angle! - \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt - \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}% - \else - \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}% - \fi - \fi - \fi - % Qrr: - % make sure direction is properly followed - \ifdim\pgf@arcto@fS pt=1pt - % counter clockwise - \ifdim\pgf@arcto@theta@end pt<\pgf@arcto@theta@start pt - \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}% - \fi - \else - % clockwise - \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt - \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}% - \fi - \fi - \xdef\pgf@marshal{\noexpand - \pgfpatharcaxes{\pgf@arcto@theta@start}{\pgf@arcto@theta@end} - {\noexpand\pgfpointpolar{\pgf@arcto@phi}{\pgf@arcto@rx}} - {\noexpand\pgfpointpolar{\pgf@arcto@phi+90}{\pgf@arcto@ry}}% - }% - \fi\fi\fi - }% - \pgf@marshal -} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.ortho.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.ortho.code.tex deleted file mode 100644 index 9740c39cc2..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.ortho.code.tex +++ /dev/null @@ -1,692 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -%% For the operators r-lr, r-rl, r-ud and r-du we need to check after TikZ found r -\let\tikz@orig@rect\tikz@rect -\def\tikz@rect{\pgfutil@ifnextchar e\tikz@orig@rect\tikzext@tikz@r} -\def\tikzext@tikz@r -{% - \pgfutil@ifnextchar l\tikzext@tikz@lr@lineto{% - \pgfutil@ifnextchar r\tikzext@tikz@rl@lineto{% - \pgfutil@ifnextchar u\tikzext@tikz@ud@lineto{% - \pgfutil@ifnextchar d\tikzext@tikz@du@lineto\tikz@expand - }% - }% - }% -} -%% For the operator |-| we need to check after TikZ found |- -\let\tikz@orig@vh@lineto@next\tikz@vh@lineto@next -\def\tikz@vh@lineto@next{% - \pgfutil@ifnextchar|{\expandafter\tikzext@tikz@vhv@lineto\pgfutil@gobble}% - {\pgfutil@ifnextchar\tikz@activebar{\expandafter\tikzext@tikz@vhv@lineto\pgfutil@gobble}% - {\tikz@orig@vh@lineto@next}}} -%% For the operator -|- we need to check after TikZ found -| -\let\tikz@orig@hv@lineto\tikz@hv@lineto -\def\tikz@hv@lineto{% - \pgfutil@ifnextchar-{\expandafter\tikzext@tikz@hvh@lineto\pgfutil@gobble}% - {\tikz@orig@hv@lineto}} - -%% |-|[] and -|-[] are allowed -\def\tikzext@tikz@vhv@lineto{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@vhv@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@vhv@lineto@next[]}} -\def\tikzext@tikz@hvh@lineto{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@hvh@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@hvh@lineto@next[]}} - -%% r-rl[], r-lr[], etc. -\def\tikzext@tikz@rl@lineto rl{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@rl@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@rl@lineto@next[]}} -\def\tikzext@tikz@lr@lineto lr{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@lr@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@lr@lineto@next[]}} -\def\tikzext@tikz@du@lineto du{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@du@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@du@lineto@next[]}} -\def\tikzext@tikz@ud@lineto ud{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@ud@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@ud@lineto@next[]}} - -%% TikZ interjects are done, the rest is independent: - -\newlength\tikzext@tikz@udlr@distance -\newlength\tikzext@tikz@hvvh@distance -\newif\iftikzext@tikz@hvvh@middle % checks whether spacing = 0 was selected -\newif\iftikzext@tikz@hvvh@fromcenter -\newif\iftikzext@ortho@preflush -\tikzext@ortho@preflushtrue - -%%% HVVH/UDLR -\tikzset{% - ortho/.code=\pgfqkeys{/tikz/ortho}{#1}, - hvvh/.code=\pgfqkeys{/tikz/ortho}{#1},% - udlr/.code=\pgfqkeys{/tikz/ortho}{#1},% - ortho/.search also=/tikz, - ortho/middle 0 to 1/.style={/tikz/ortho/spacing=0},% - ortho/from center/.is if=tikzext@tikz@hvvh@fromcenter,% - ortho/spacing/.code=% spacing = 0 means that the middle part are the pos-itions 0 to 1, - % the first part is -1 to 0, the last part is to 2 - \pgfmathint{#1}\let\tikzext@tikz@hvvh@timing@parts\pgfmathresult% in case they are calculations to be done - \ifcase\tikzext@tikz@hvvh@timing@parts\relax - \tikzext@tikz@hvvh@middletrue - \def\tikzext@tikz@hvvh@timing@parts{1}% - \def\tikzext@tikz@hvvh@timing@first{0}% - \def\tikzext@tikz@hvvh@timing@last{1}% - \def\tikzext@tikz@hvvh@timing@subtr{0}% - \def\tikzext@tikz@hvvh@timing@factor{1}% - \else % in all other cases n > 0 the kinks are at pos = 1/n and (n - 1)/n - \tikzext@tikz@hvvh@middlefalse - \pgfmathreciprocal{#1}\let\tikzext@tikz@hvvh@timing@first\pgfmathresult - \pgfmathsetmacro\tikzext@tikz@hvvh@timing@last{1-\pgfmathresult}% - \pgfmathreciprocal{#1-2}% - \let\tikzext@tikz@hvvh@timing@subtr\pgfmathresult - \pgfmathsetmacro\tikzext@tikz@hvvh@timing@factor{1+2*\pgfmathresult}% - \fi,% - ortho/ratio/.code=\pgfmathsetmacro\tikzext@tikz@hvvh@ratio{#1},% - % TODO: not possible to do distance in TikZ coordinate system - ortho/distance/.code=\pgfmathsetlength\tikzext@tikz@hvvh@distance{#1}\let\tikzext@tikz@hvvh@ratio\pgfutil@empty,% - ortho/udlr distance/.style={% - /tikz/ortho/ud distance={#1},% - /tikz/ortho/du distance={#1},% - /tikz/ortho/lr distance={#1},% - /tikz/ortho/rl distance={#1}},% - ortho/ud distance/.initial=+.5cm,% - ortho/du distance/.initial=+.5cm,% - ortho/lr distance/.initial=+.5cm,% - ortho/rl distance/.initial=+.5cm,% - ortho/ratio=.5,% default value - ortho/spacing=4,% default value -}% - -%BEGIN_FOLD Timer -\def\tikz@timer@hvhline{% - \pgf@process{\tikz@timer@start}\pgf@ya\pgf@y - \pgf@process{\tikz@timer@end}\pgf@yc\pgf@y - \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% - \ifdim\tikz@time pt<\tikzext@tikz@hvvh@timing@first pt% first quarter - \iftikzext@tikz@hvvh@middle - \advance\pgf@xb1pt% - \else - \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb - \fi - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% - \else - \ifdim\tikz@time pt>\tikzext@tikz@hvvh@timing@last pt% last quarter - \iftikzext@tikz@hvvh@middle - \advance\pgf@xb-1pt% - \else - \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb - \fi - \advance\pgf@xb\dimexpr-\tikzext@tikz@hvvh@timing@parts pt+1pt\relax% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@yc}}{\noexpand\tikz@timer@end}}% - \else% middle half - \pgf@xb\tikzext@tikz@hvvh@timing@factor\pgf@xb% - \advance\pgf@xb-\tikzext@tikz@hvvh@timing@subtr pt% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@middle}}% - \fi\fi\tikz@marshal} -\def\tikz@timer@vhvline{% - \pgf@process{\tikz@timer@start}\pgf@xa\pgf@x - \pgf@process{\tikz@timer@end}\pgf@xc\pgf@x - \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% - \ifdim\tikz@time pt<\tikzext@tikz@hvvh@timing@first pt% first quarter - \iftikzext@tikz@hvvh@middle - \advance\pgf@xb1pt% - \else - \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb - \fi - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% - \else - \ifdim\tikz@time pt>\tikzext@tikz@hvvh@timing@last pt% last quarter - \iftikzext@tikz@hvvh@middle - \advance\pgf@xb-1pt% - \else - \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb - \fi - \advance\pgf@xb by\dimexpr-\tikzext@tikz@hvvh@timing@parts pt+1pt\relax% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% - \else% middle half - \pgf@xb=\tikzext@tikz@hvvh@timing@factor\pgf@xb - \advance\pgf@xb by-\tikzext@tikz@hvvh@timing@subtr pt% - \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@middle}}% - \fi\fi\tikz@marshal}% - -%% collect options and nodes, coordinates and pics onpath -\let\tikz@hvvh@currentoption\pgfutil@empty -\def\tikzext@tikz@collect@hvvh@options#1[#2]{\edef\tikz@hvvh@currentoption{#2}#1} -\def\tikzext@tikz@hvh@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@hvh@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@hvh@lineto@next}% - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@hvh@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@hvh@lineto}}}}% -\def\tikzext@tikz@vhv@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@vhv@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@vhv@lineto@next}% - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@vhv@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@vhv@lineto}}}}% -\def\tikzext@tikz@ud@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@ud@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@ud@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@ud@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@ud@lineto}}}}% -\def\tikzext@tikz@du@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@du@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@du@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@du@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@du@lineto}}}}% -\def\tikzext@tikz@lr@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@lr@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@lr@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@lr@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@lr@lineto}}}}% -\def\tikzext@tikz@rl@lineto@next{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@rl@lineto@next} - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@rl@lineto@next} - {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@rl@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@rl@lineto}}}}% - -\def\tikz@do@hvvh#1#2#3#4#5{% -% #1 = first kink -% #2 = second kink -% #3 = end -% #4 = timer -% #5 = tikz@shapeborder@name - \pgfpathlineto{#1}% - \pgfpathlineto{#2}% - \pgfpathlineto{#3}% - \def\tikz@timer@middle{#2}% - \def\tikz@timer@end{#3}% - \let\tikz@timer#4 - \edef\pgf@temp{#5}% - \ifx\pgf@temp\pgfutil@empty - \let\tikz@moveto@waiting\relax - \else - \let\tikz@moveto@waiting\pgf@temp - \fi - \tikz@scan@next@command}% - -%% -|- operator -\def\tikzext@tikz@@hvh@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xb=\tikz@lastx - \pgf@xc=\tikz@lastx - \pgf@yc=\tikz@lasty - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@xc\pgf@yc - \begingroup - \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \iftikz@shapeborder - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xb}{\tikz@lasty}}}% - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \fi - \pgfutil@ifxempty\tikzext@tikz@hvvh@ratio{% - \ifdim\tikzext@tikz@hvvh@distance<0pt\relax - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc\tikz@lastx - \else - \pgf@xc\pgf@x - \fi - \fi - \ifdim\pgf@xb>\tikz@lastx - \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance - \fi - }{% - \iftikzext@tikz@hvvh@fromcenter - \tikzext@tikz@hvvh@distance\tikz@lastx - \else - \tikzext@tikz@hvvh@distance\pgf@x - \fi - \advance\tikzext@tikz@hvvh@distance-\pgf@xc - \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance - }% - \advance\pgf@xc\tikzext@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \fi - \pgfutil@ifxempty\tikzext@tikz@hvvh@ratio{% - \ifdim\tikzext@tikz@hvvh@distance<0pt\relax - \pgf@xc\tikz@lastx - \fi - \ifdim\pgf@xb>\tikz@lastx - \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance - \fi - }{% - \tikzext@tikz@hvvh@distance\tikz@lastx - \advance\tikzext@tikz@hvvh@distance-\pgf@xc - \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance - }% - \advance\pgf@xc\tikzext@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi% - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\expandafter\noexpand\pgf@tempa}% - {\expandafter\noexpand\pgf@tempb}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% |-| operator -\def\tikzext@tikz@@vhv@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc=\tikz@lastx - \pgf@yb=\tikz@lasty - \pgf@yc=\tikz@lasty - \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@yc - \begingroup - \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \iftikz@shapeborder - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yb}}}% - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \fi - \ifx\tikzext@tikz@hvvh@ratio\pgfutil@empty - \ifdim\tikzext@tikz@hvvh@distance<0pt\relax - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc\tikz@lasty - \else - \pgf@yc\pgf@y - \fi - \fi - \ifdim\pgf@yb>\tikz@lasty - \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance - \fi - \else - \iftikzext@tikz@hvvh@fromcenter - \tikzext@tikz@hvvh@distance\tikz@lasty - \else - \tikzext@tikz@hvvh@distance\pgf@y - \fi - \advance\tikzext@tikz@hvvh@distance-\pgf@yc - \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance - \fi - \advance\pgf@yc\tikzext@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \fi - \ifx\tikzext@tikz@hvvh@ratio\pgfutil@empty - \ifdim\tikzext@tikz@hvvh@distance<0pt\relax - \pgf@yc\tikz@lasty - \fi - \ifdim\pgf@yb>\tikz@lasty - \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance - \fi - \else - \tikzext@tikz@hvvh@distance\tikz@lasty - \advance\tikzext@tikz@hvvh@distance-\pgf@yc - \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance - \fi - \advance\pgf@yc\tikzext@tikz@hvvh@distance - \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi% - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\expandafter\noexpand\pgf@tempa}% - {\expandafter\noexpand\pgf@tempb}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-ud operator -\def\tikzext@tikz@@ud@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc\tikz@lastx - \pgf@yb\tikz@lasty - \advance\tikz@lasty1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/ud distance}}% - \iftikz@shapeborder - \advance\pgf@y1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \else\ifx\pgf@temp\relax - \pgf@yc\pgf@yb - \fi - \fi - \ifdim\pgf@yc<\pgf@y - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc=\tikz@lasty - \else - \pgf@yc=\pgf@y - \fi - \fi - \advance\pgf@yc\tikzext@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifx\pgf@temp\relax\else - \iftikzext@tikz@hvvh@fromcenter\else - \pgf@yb\pgf@yc - \fi - \fi - \ifdim\pgf@yb<\tikz@lasty\pgf@yb\tikz@lasty\fi - \advance\pgf@yb\tikzext@tikz@udlr@distance - \pgf@yc\pgf@yb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-du operator -\def\tikzext@tikz@@du@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xc\tikz@lastx - \pgf@yb\tikz@lasty - \advance\tikz@lasty-1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/du distance}}% - \iftikz@shapeborder - \advance\pgf@y-1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc\pgf@yb - \else\ifx\pgf@temp\relax - \pgf@yc\pgf@yb - \fi - \fi - \ifdim\pgf@yc>\pgf@y - \iftikzext@tikz@hvvh@fromcenter - \pgf@yc=\tikz@lasty - \else - \pgf@yc=\pgf@y - \fi - \fi - \advance\pgf@yc-\tikzext@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifx\pgf@temp\relax\else - \iftikzext@tikz@hvvh@fromcenter\else - \pgf@yb\pgf@yc - \fi - \fi - \ifdim\pgf@yb>\tikz@lasty\pgf@yb\tikz@lasty\fi - \advance\pgf@yb-\tikzext@tikz@udlr@distance - \pgf@yc\pgf@yb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-lr operator -\def\tikzext@tikz@@lr@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xb\tikz@lastx - \pgf@yc\tikz@lasty - \advance\tikz@lastx-1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/lr distance}}% - \iftikz@shapeborder - \advance\pgf@x-1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \else\ifx\pgf@temp\relax - \pgf@xc\pgf@xb - \fi - \fi - \ifdim\pgf@xc>\pgf@x - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc=\tikz@lastx - \else - \pgf@xc=\pgf@x - \fi - \fi - \advance\pgf@xc-\tikzext@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty - \ifx\pgf@temp\relax\else - \iftikzext@tikz@hvvh@fromcenter\else - \pgf@xb\pgf@xc - \fi - \fi - \ifdim\pgf@xb>\tikz@lastx\pgf@xb\tikz@lastx\fi - \advance\pgf@xb-\tikzext@tikz@udlr@distance - \pgf@xc\pgf@xb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% r-rl operator -\def\tikzext@tikz@@rl@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \pgf@xb\tikz@lastx - \pgf@yc\tikz@lasty - \advance\tikz@lastx1pt% - \let\pgf@temp\tikz@moveto@waiting - \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc - \tikz@make@last@position{#1}% - \begingroup - \pgfqkeys{/tikz/udlr}{/tikz/ortho/.expand once=\tikz@hvvh@currentoption}% - \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/rl distance}}% - \iftikz@shapeborder% - \advance\pgf@x1pt% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc\pgf@xb - \else\ifx\pgf@temp\relax - \pgf@xc\pgf@xb - \fi - \fi - \ifdim\pgf@xc<\pgf@x - \iftikzext@tikz@hvvh@fromcenter - \pgf@xc=\tikz@lastx - \else - \pgf@xc=\pgf@x - \fi - \fi - \advance\pgf@xc\tikzext@tikz@udlr@distance - \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% - \else - \let\tikz@shapeborder@name\pgfutil@empty% - \ifx\pgf@temp\relax\else - \iftikzext@tikz@hvvh@fromcenter\else - \pgf@xb\pgf@xc - \fi - \fi - \ifdim\pgf@xb<\tikz@lastx\pgf@xb\tikz@lastx\fi - \advance\pgf@xb\tikzext@tikz@udlr@distance - \pgf@xc\pgf@xb - \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \fi - \xdef\pgf@marshal{% - \noexpand\tikz@do@hvvh - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% - {\expandafter\noexpand\pgf@temp}% - {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% - \endgroup - \pgf@marshal}% - -%% a few nice to haves, use with to or edge operator -\tikzset{ - node as new start/.is if=tikzext@ortho@preflush, - node as new start, - ortho/install shortcuts/.style={ - *|/.style={only vertical second={#1}}, *|/.default=, - |*/.style={only vertical first={#1}}, |*/.default=, - *-/.style={only horizontal second={#1}}, *-/.default=, - -*/.style={only horizontal first={#1}}, -*/.default=, - |-/.style={to path={|-(\tikztotarget)\tikztonodes}}, - -|/.style={to path={-|(\tikztotarget)\tikztonodes}}, - -|-/.style=/tikz/horizontal vertical horizontal, - |-|/.style=/tikz/vertical horizontal vertical, - }, - horizontal vertical/.style={to path={-| (\tikztotarget) \tikztonodes}}, - vertical horizontal/.style={to path={|- (\tikztotarget) \tikztonodes}}, - horizontal vertical horizontal/.style={to path={-|- (\tikztotarget) \tikztonodes}}, - vertical horizontal vertical/.style={to path={|-| (\tikztotarget) \tikztonodes}}, - only vertical second/.style={to path={ - \pgfextra - \let\tikzext@ortho@anchor\pgfutil@empty - \let\tikzext@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \iftikz@shapeborder - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \ifdim\pgf@y>\tikz@lasty\relax - \edef\tikztostart{\tikztostart.north}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.south}\fi - \else - \edef\tikztostart{\tikztostart.south}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.north}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \let\tikzext@origtotarget\tikztotarget - \edef\tikztotarget{[xshift={#1}]\tikztotarget\tikzext@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={ - (perpendicular cs: horizontal line through={(\tikztostart)}, - vertical line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes - \pgfextra - \ifx\tikzext@origtotarget\pgfutil@empty\else - \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, - only vertical second/.default=, - only horizontal second/.style={to path={ - \pgfextra - \let\tikzext@ortho@anchor\pgfutil@empty - \let\tikzext@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \iftikz@shapeborder - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \ifdim\pgf@x>\tikz@lastx\relax - \edef\tikztostart{\tikztostart.east}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.west}\fi - \else - \edef\tikztostart{\tikztostart.west}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.east}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \let\tikzext@origtotarget\tikztotarget - \edef\tikztotarget{[yshift={#1}]\tikztotarget\tikzext@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={ - (perpendicular cs: vertical line through={(\tikztostart)}, - horizontal line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes - \pgfextra - \ifx\tikzext@origtotarget\pgfutil@empty\else - \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, - only horizontal second/.default=, - only vertical first/.style={to path={ - \pgfextra - \let\tikzext@ortho@anchor\pgfutil@empty - \let\tikzext@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \pgf@ya=\pgf@y - \iftikz@shapeborder - \let\tikzext@origtotarget\tikztotarget - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \ifdim\pgf@ya>\tikz@lasty\relax - \edef\tikztotarget{\tikztotarget.south}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.north}\fi - \else - \edef\tikztotarget{\tikztotarget.north}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.south}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \edef\tikztostart{[xshift={#1}]\tikztostart\tikzext@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={(\tikztostart)}] - -- (perpendicular cs: vertical line through/.expanded={(\tikztostart)}, - horizontal line through={(\tikztotarget)}) - \tikztonodes - \pgfextra - \ifx\tikzext@origtotarget\pgfutil@empty\else - \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, - only vertical first/.default=, - only horizontal first/.style={to path={ - \pgfextra - \let\tikzext@ortho@anchor\pgfutil@empty - \let\tikzext@origtotarget\pgfutil@empty - \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax - \pgf@xa=\pgf@x - \iftikz@shapeborder - \let\tikzext@origtotarget\tikztotarget - \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax - \ifdim\pgf@xa>\tikz@lastx\relax - \edef\tikztotarget{\tikztotarget.west}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.east}\fi - \else - \edef\tikztotarget{\tikztotarget.east}% - \iftikz@shapeborder\def\tikzext@ortho@anchor{.west}\fi - \fi - \fi - \def\tikz@tempa{#1}% - \ifx\tikz@tempa\pgfutil@empty\else - \edef\tikztostart{[yshift={#1}]\tikztostart\tikzext@ortho@anchor}% - \fi - \endpgfextra - [insert path/.expanded={(\tikztostart)}] - -- (perpendicular cs: horizontal line through/.expanded={(\tikztostart)}, - vertical line through={(\tikztotarget)}) - \tikztonodes \pgfextra - \ifx\tikzext@origtotarget\pgfutil@empty\else - \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, - only horizontal first/.default=, - only vertical first to center/.style={to path={ - \pgfextra - \let\tikzext@origtotarget\tikztotarget - \endpgfextra - (\tikztostart) -- (perpendicular cs: vertical line through={(\tikztostart)}, - horizontal line through={(\tikztotarget)}) - \tikztonodes \ifx\tikzext@origtotarget\pgfutil@empty\else\iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi}}, - only horizontal first to center/.style={to path={ - \pgfextra - \let\tikzext@origtotarget\tikztotarget - \endpgfextra - (\tikztostart) -- (perpendicular cs: horizontal line through={(\tikztostart)}, - vertical line through={(\tikztotarget)}) - \tikztonodes \ifx\tikzext@origtotarget\pgfutil@empty\else\iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi}}% -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex deleted file mode 100644 index 3a4d30e68f..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.paths.timer.code.tex +++ /dev/null @@ -1,188 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\def\tikz@rectB#1{% originally from tikz.code.tex - \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% - \let\tikz@timer\tikz@timer@rectangle% %% Timer: new timer - \tikz@@movetosave{\pgfqpoint{\pgf@xa}{\pgf@ya}}% - \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% - \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% - \iftikz@snaked - \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% - \fi - \pgfpathclose - \tikz@@movetosave{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - \def\pgfstrokehook{}% - \let\tikz@tangent\relax - \tikz@scan@next@command -}% - -\def\tikz@@sine#1{% originally from tikz.code.tex - \let\tikz@tangent\tikz@tangent@lookup - \tikz@flush@moveto - \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position - \pgf@process{#1}% - \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: saver target position - \pgf@xc=\pgf@x - \pgf@yc=\pgf@y - \advance\pgf@xc by-\tikz@lastx - \advance\pgf@yc by-\tikz@lasty - \advance\tikz@lastx by\pgf@xc - \advance\tikz@lasty by\pgf@yc - \tikz@lastxsaved=\tikz@lastx - \tikz@lastysaved=\tikz@lasty - \tikz@updatecurrenttrue - \let\tikz@timer=\tikz@timer@sine% %% Timer: new timer - \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \tikz@scan@next@command -} - -\def\tikz@@cosine#1{% originally from tikz.code.tex - \let\tikz@tangent\tikz@tangent@lookup - \tikz@flush@moveto - \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position - \pgf@process{#1}% - \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: save target position - \pgf@xc=\pgf@x - \pgf@yc=\pgf@y - \advance\pgf@xc by-\tikz@lastx - \advance\pgf@yc by-\tikz@lasty - \advance\tikz@lastx by\pgf@xc - \advance\tikz@lasty by\pgf@yc - \tikz@lastxsaved=\tikz@lastx - \tikz@lastysaved=\tikz@lasty - \tikz@updatecurrenttrue - \let\tikz@timer=\tikz@timer@cosine% %% Timer: new timer - \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% - \tikz@scan@next@command -} - -\def\tikz@timer@rectangle{% - \pgfutil@tempdima\tikz@time pt - \ifdim\pgfutil@tempdima<.5pt\else % if we're at the return pos-ition we switch start and end - \advance\pgfutil@tempdima-.5pt - \let\pgf@tempa\tikz@timer@start - \let\tikz@timer@start\tikz@timer@end - \let\tikz@timer@end\pgf@tempa - \fi - \multiply\pgfutil@tempdima2 - \edef\tikz@time{\strip@pt\pgfutil@tempdima}% - \tikz@timer@hvline}% - -\def\tikz@parabola@semifinal#1{% - \tikz@flush@moveto - % Save original start: - \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position - \pgf@xb=\tikz@lastx - \pgf@yb=\tikz@lasty - \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save target position - \pgf@xc=\tikz@lastx - \pgf@yc=\tikz@lasty - \begingroup% now calculate bend: - \let\tikz@after@path\pgfutil@empty - \expandafter\tikzset\expandafter{\tikz@parabola@option}% - \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx - \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty - \advance\tikz@lastxsaved by\pgf@xb - \advance\tikz@lastysaved by\pgf@yb - \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb - \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb - \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% - \edef\tikz@timer@middle{{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save bend postion - % Calculate delta from bend - \advance\pgf@xc by-\tikz@lastx - \advance\pgf@yc by-\tikz@lasty - % Ok, now calculate delta to bend - \advance\tikz@lastx by-\pgf@xb - \advance\tikz@lasty by-\pgf@yb - \edef\tikz@marshall{% - \noexpand\let\noexpand\tikz@timer\noexpand\tikz@timer@parabola - \noexpand\edef\noexpand\tikz@timer@middle{\noexpand\pgfqpoint\tikz@timer@middle}% - \noexpand\pgfpathparabola{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - }% - \expandafter\endgroup% - \tikz@marshall - \expandafter\tikz@scan@next@command\tikz@after@path% -}% - -\def\tikz@timer@parabola{% following calculations, see \def of \pgfpathparabola in pgfcorepathconstruct.code.tex (l. 1261) - \ifdim\tikz@time pt<.5pt\relax % first part - \pgf@process{\tikz@timer@middle}% - \pgf@xc\pgf@x\pgf@yc\pgf@y - \pgf@xb\pgf@x\pgf@yb\pgf@y - \pgf@process{\tikz@timer@start}% - \advance\pgf@xc-\pgf@x\pgf@xc.1125\pgf@xc - \advance\pgf@xc\pgf@x % = start_x + .1125 (middle_x - start_x) - \advance\pgf@yc-\pgf@y\pgf@yc.225\pgf@yc - \advance\pgf@yc\pgf@y % = start_y + .225 (middle_y - start_y) - \advance\pgf@xb\pgf@x\pgf@xb.5\pgf@xb % = .5 (middle_x + start_x) = start_x + .5 (middle_x - start_x) - \pgf@xa=\tikz@time pt% - \pgf@xa=2\pgf@xa % = 2 * \tikz@time - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@start}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@middle}}% - \else % second part - \pgf@process{\tikz@timer@end}% - \pgf@xc\pgf@x - \pgf@xb\pgf@x - \pgf@yb\pgf@y - \pgf@process{\tikz@timer@middle}% - \advance\pgf@xc\pgf@x\pgf@xc.5\pgf@xc % = .5 (end_x + middle_x) = middle_x + .5 (end_x - middle_x) - \advance\pgf@xb-\pgf@x\pgf@xb.8875\pgf@xb - \advance\pgf@xb\pgf@x % = middle_x + .8875 (end_x - middle_x) - \advance\pgf@yb-\pgf@y\pgf@yb.775\pgf@yb - \advance\pgf@yb\pgf@y % = middle_y + .775 (end_y - middle_y) - \pgf@xa=\tikz@time pt% - \advance\pgf@xa-.5pt% - \pgf@xa=2\pgf@xa % = 2 (\tikz@zime - .5) - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@middle}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@end}}% - \fi - \tikz@marshall -} - -\def\tikz@timer@sine{% following calculations, see \def of \pgfpathsine in pgfcorepathconstruct.code.tex (l. 1315) - \pgf@process{\tikz@timer@end}% - \pgf@xc\pgf@x\pgf@yc\pgf@y - \pgf@xb\pgf@x\pgf@yb\pgf@y - \pgf@process{\tikz@timer@start}% - \advance\pgf@xc-\pgf@x\pgf@xc.3260\pgf@xc - \advance\pgf@xc\pgf@x % = start_x + .3260 (end_x - start_x) - \advance\pgf@yc-\pgf@y\pgf@yc.5120\pgf@yc - \advance\pgf@yc\pgf@y % = start_y + .5120 (end_y - start_y) - \advance\pgf@xb-\pgf@x\pgf@xb.6380\pgf@xb % = start_x + .6380 (end_x - start_x) - \advance\pgf@xb\pgf@x - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@end}}% - \tikz@marshall -} -\def\tikz@timer@cosine{% following calculations, see \def of \pgfpathcosine in pgfcorepathconstruct.code.tex (l. 1345) - \pgf@process{\tikz@timer@end}% - \pgf@xc\pgf@x\pgf@yc\pgf@y - \pgf@xb\pgf@x\pgf@yb\pgf@y - \pgf@process{\tikz@timer@start}% - \advance\pgf@xb-\pgf@x\pgf@xb.6740\pgf@xb - \advance\pgf@xb\pgf@x % = start_x + .6740 (end_x - start_x) - \advance\pgf@yb-\pgf@y\pgf@yb.4880\pgf@yb - \advance\pgf@yb\pgf@y % = start_y + .4880 (end_y - start_y) - \advance\pgf@xc-\pgf@x\pgf@xc.3620\pgf@xc % = start_x + .3620 (end_x - start_x) - \advance\pgf@xc\pgf@x - \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% - {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% - {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\tikz@timer@end}}% - \tikz@marshall -} -\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.patterns.images.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.patterns.images.code.tex deleted file mode 100644 index aa732ab835..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.patterns.images.code.tex +++ /dev/null @@ -1,60 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -% This is the TikZ library patterns.images -% Load with \usetikzlibrary{patterns.images} -% -% Macro: -% - \pgfSetupImageAsPattern[]{}{} -% -% Keys are: -% - use image as pattern= -% - image as pattern= - -\def\pgfsetupimageaspattern{\pgfutil@ifnextchar[\tikzext@pgfsetupimageaspattern{\tikzext@pgfsetupimageaspattern[]}} -\def\tikzext@pgfsetupimageaspattern[#1]#2#3{% #1 = options - % #2 = image name - % #3 = file name - \pgfdeclareimage[#1]{tikzext@pgf@iap@#2}{#3}% - \sbox\pgfutil@tempboxa{\pgfuseimage{tikzext@pgf@iap@#2}}% - \expandafter\edef\csname tikzext@pgf@iap@#2@\endcsname{{\the\wd\pgfutil@tempboxa}{\the\ht\pgfutil@tempboxa}}% -} -\tikzset{ - image as pattern/name/.initial=, - image as pattern/option/.style=, - image as pattern/options/.style={/tikz/image as pattern/option/.append style={#1}}, - image as pattern/.default=, - image as pattern/.code={ - \pgfqkeys{/tikz/image as pattern}{#1}% - \pgfkeysgetvalue{/tikz/image as pattern/name}\tikz@temp - \pgfutil@ifxempty\tikz@temp{% - \tikzerror{You need to specify a name for the ``image-pattern'' to be used.}% - }{% - \edef\tikz@tempa{\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname tikzext@pgf@iap@\tikz@temp @\endcsname}% - \edef\tikz@tempb{\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname tikzext@pgf@iap@\tikz@temp @\endcsname}% - \pgfkeysalso{/tikz/path picture={% - \pgf@process{\pgfpointanchor{path picture bounding box}{north east}}% - \pgf@xa\pgf@x\pgf@ya\pgf@y - \pgf@process{\pgfpointanchor{path picture bounding box}{south west}}% - \pgf@xb\pgf@x\pgf@yb\pgf@y\pgf@yc\pgf@yb - \pgfutil@loop - {% - \pgfutil@loop - \expandafter\pgftext\expandafter[/tikz/image as pattern/option,at=\pgfqpoint{\pgf@xb}{\pgf@yb}]{\pgfuseimage{tikzext@pgf@iap@\tikz@temp}}% - \ifdim\pgf@yb<\pgf@ya - \advance\pgf@yb\tikz@tempb - \pgfutil@repeat - }% - \ifdim\pgf@xb<\pgf@xa - \advance\pgf@xb\tikz@tempa - \pgf@yb\pgf@yc - \pgfutil@repeat - }}% - } - } -} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.positioning-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.positioning-plus.code.tex deleted file mode 100644 index 98de181c27..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.positioning-plus.code.tex +++ /dev/null @@ -1,262 +0,0 @@ -% This is the TikZ library positioning-plus -% Load with \usetikzlibrary{positioning-plus} -% -% This small library extends TikZ options like 'above', 'left' or 'below right' -% so that they can be used with an optional prefixed factor seperated by ':' (colon) -% -% The option 'left=.5:of somenode' will place -% a new node .5cm (default 'node distance' is '1cm and 1cm') left to (somenode). -% The option 'above right=.2 and .7:of someothernode' will place -% a new node .2cm above and .7cm right of (someothernode). -% -% Additional the options 'xshift*' and 'yshift*' add an additional shift -% as a factor of 'node distance' -% Inspired by http://tex.stackexchange.com/a/117610/16595 - -\usetikzlibrary{positioning} -\usetikzlibrary{fit} - -\pgfdeclaregenericanchor{corner south east}{% - \pgf@sh@reanchor{#1}{south}% - \pgf@ya\pgf@y - \pgf@process{\pgf@sh@reanchor{#1}{east}}% - \pgf@y\pgf@ya -} -\pgfdeclaregenericanchor{corner north east}{% - \pgf@sh@reanchor{#1}{north}% - \pgf@ya\pgf@y - \pgf@process{\pgf@sh@reanchor{#1}{east}}% - \pgf@y\pgf@ya -} -\pgfdeclaregenericanchor{corner south west}{% - \pgf@sh@reanchor{#1}{south}% - \pgf@ya\pgf@y - \pgf@process{\pgf@sh@reanchor{#1}{west}}% - \pgf@y\pgf@ya -} -\pgfdeclaregenericanchor{corner north west}{% - \pgf@sh@reanchor{#1}{north}% - \pgf@ya\pgf@y - \pgf@process{\pgf@sh@reanchor{#1}{west}}% - \pgf@y\pgf@ya -} - -\tikzset{corner above left/.code=\tikz@lib@place@handle@{#1}{corner south east}{-1}{1}{corner north west}{0.707106781}} -\tikzset{corner above right/.code=\tikz@lib@place@handle@{#1}{corner south west}{1}{1}{corner north east}{0.707106781}} -\tikzset{corner below left/.code=\tikz@lib@place@handle@{#1}{corner north east}{-1}{-1}{corner south west}{0.707106781}} -\tikzset{corner below right/.code=\tikz@lib@place@handle@{#1}{corner north west}{1}{-1}{corner south east}{0.707106781}} - -\tikzset{corner north left/.code =\tikz@lib@place@handle@{#1}{corner north east}{-1}{0}{corner north west}{1}} -\tikzset{corner north right/.code=\tikz@lib@place@handle@{#1}{corner north west}{1}{0}{corner north east}{1}} -\tikzset{corner south left/.code =\tikz@lib@place@handle@{#1}{corner south east}{-1}{0}{corner south west}{1}} -\tikzset{corner south right/.code=\tikz@lib@place@handle@{#1}{corner south west}{1}{0}{corner south east}{1}} - -\tikzset{corner west above/.code =\tikz@lib@place@handle@{#1}{corner south west}{0}{1}{corner north west}{1}} -\tikzset{corner west below/.code=\tikz@lib@place@handle@{#1}{corner north west}{0}{-1}{corner south west}{1}} -\tikzset{corner east above/.code =\tikz@lib@place@handle@{#1}{corner south east}{0}{1}{corner north east}{1}} -\tikzset{corner east below/.code=\tikz@lib@place@handle@{#1}{corner north east}{0}{-1}{corner south east}{1}} - -\tikzset{north left/.code =\tikz@lib@place@handle@{#1}{north east}{-1}{0}{north west}{1}} -\tikzset{north right/.code=\tikz@lib@place@handle@{#1}{north west}{1}{0}{north east}{1}} -\tikzset{south left/.code =\tikz@lib@place@handle@{#1}{south east}{-1}{0}{south west}{1}} -\tikzset{south right/.code=\tikz@lib@place@handle@{#1}{south west}{1}{0}{south east}{1}} - -\tikzset{west above/.code =\tikz@lib@place@handle@{#1}{south west}{0}{1}{north west}{1}} -\tikzset{west below/.code=\tikz@lib@place@handle@{#1}{north west}{0}{-1}{south west}{1}} -\tikzset{east above/.code =\tikz@lib@place@handle@{#1}{south east}{0}{1}{north east}{1}} -\tikzset{east below/.code=\tikz@lib@place@handle@{#1}{north east}{0}{-1}{south east}{1}} - -\newif\iftikzext@tikz@lib@place@postransform -\tikzset{node distance transformation/.is if=qrr@tikz@lib@place@postransform} -\def\tikz@lib@place@handle@@#1#2#3#4{% - \pgfutil@in@{of }{#1}% - \ifpgfutil@in@ - \tikz@lib@place@of#1\tikz@stop{#4}% - \else - \edef\tikz@lib@place@nums{#1}% - \fi - \ifx\tikz@lib@place@nums\pgfutil@empty - % Ok, nothing to do, we have set the anchor and we are happy... - \else - \expandafter\tikz@lib@place@parse@nums\expandafter{\tikz@lib@place@nums}% - \pgf@x=#2\pgf@x - \pgf@y=#3\pgf@y - \iftikzext@tikz@lib@place@postransform - \pgf@pos@transform{\pgf@x}{\pgf@y}% change from original - \fi - \edef\tikz@lib@pos@call{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% - \fi -} - -\def\tikz@lib@place@handle@#1#2#3#4#5#6{% - \pgfutil@in@{:}{#1}% - \ifpgfutil@in@ - \tikzext@lib@place@handle@#1\tikz@stop - \ifx\pgf@temp\pgfutil@empty - \let\pgf@temp\tikz@node@distance - \fi - \pgfmathsetmacro\pgf@tempa{(\pgf@tempa)*#4}% - \pgfmathsetmacro\pgf@tempb{(\pgf@tempb)*#3}% - \edef\pgf@marshal{\noexpand\tikz@lib@place@handle@{\pgf@temp}{#2}{\pgf@tempb}{\pgf@tempa}{#5}{#6}}% - \pgf@marshal - \else - \def\tikz@anchor{#2}% - \let\tikz@do@auto@anchor=\relax - \edef\tikz@temp{#1}% - \def\tikz@lib@place@single@factor{#6}% - \expandafter\tikz@lib@place@handle@@\expandafter{\tikz@temp}{#3}{#4}{#5}% - \fi -} -\def\tikzext@lib@place@handle@#1:#2\tikz@stop{% - \pgfutil@in@{and}{#1}% - \ifpgfutil@in@ - \tikzext@lib@place@handle@@#1\tikz@stop - \else - \tikzext@lib@place@handle@@#1and#1\tikz@stop - \fi - \def\pgf@temp{#2}% -} -\def\tikzext@lib@place@handle@@#1and#2\tikz@stop{% - \def\pgf@tempa{#1}% - \def\pgf@tempb{#2}% -} -\def\tikzext@xyshift@starred#1#2#3{% - \edef\tikz@marshal{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% - \tikz@marshal - \ifpgfutil@in@ - \expandafter\tikzext@lib@place@handle@@\tikz@node@distance\tikz@stop - \else - \let#3\tikz@node@distance - \fi - \pgfmathparse{(#1)*#3}% - \ifpgfmathunitsdeclared - \if#2x% - \pgftransformshift{\pgfqpoint{\pgfmathresult pt}{0pt}}% - \else - \pgftransformshift{\pgfqpoint{0pt}{\pgfmathresult pt}}% - \fi - \else - \ifx#2x% - \pgf@process{\pgfqpointxy{\pgfmathresult}{0}}% - \else - \pgf@process{\pgfqpointxy{0}{\pgfmathresult}}% - \fi - \pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}% - \fi} -\tikzset{ - xshift*/.code=\tikzext@xyshift@starred{#1}x\pgf@tempb, - yshift*/.code=\tikzext@xyshift@starred{#1}y\pgf@tempa -} - -\def\pgfutil@firstofmany#1#2\pgf@stop{#1} -\def\pgfutil@secondofmany#1#2\pgf@stop{#2} -\def\tikz@lib@place@of@#1#2#3{% - \def\pgf@tempa{fit bounding box}% - \edef\pgf@temp{\expandafter\pgfutil@firstofmany#2\pgf@stop} - \if\pgf@temp(% - \tikz@lib@place@fit@scan{#2}{0}% - \else\if\pgf@temp|% - \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}% - \else\ifx\pgf@temp\tikz@activebar - \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}% - \else\if\pgf@temp-% - \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{2}% - \else\if\pgf@temp+% - \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{3}% - \else - \def\pgf@tempa{#2}% - \fi - \fi - \fi - \fi - \fi - \expandafter\tikz@scan@one@point\expandafter\tikz@lib@place@remember\expandafter(\pgf@tempa)% - \iftikz@shapeborder% - % Ok, this is relative to a border. - \iftikz@lib@ignore@size% - \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{center}}% - \def\tikz@anchor{center}% - \else% - \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{#3}}% - \fi% - \fi% - \edef\tikz@lib@place@nums{#1}% -} -\def\tikz@lib@place@fit@scan#1#2{% - \pgf@xb=-16000pt\relax% - \pgf@xa=16000pt\relax% - \pgf@yb=-16000pt\relax% - \pgf@ya=16000pt\relax% - \if\pgfutil@firstofmany#1\pgf@stop(% - \tikz@lib@fit@scan#1\pgf@stop% - \else - \tikz@lib@fit@scan(#1)\pgf@stop - \fi - \ifdim\pgf@xa>\pgf@xa - % shouldn't happen - \else - \expandafter\def\csname pgf@sh@ns@fit bounding box\endcsname{rectangle}% - \expandafter\edef\csname pgf@sh@np@fit bounding box\endcsname{% - \def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% - \def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% - }% - \expandafter\def\csname pgf@sh@nt@fit bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% - \expandafter\def\csname pgf@sh@pi@fit bounding box\expandafter\endcsname\expandafter{\pgfpictureid}% - \ifcase#2\relax - \or % 1 = vertical - \pgf@y=\pgf@yb% - \advance\pgf@y by-\pgf@ya% - \edef\pgf@marshal{\noexpand\pgfset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})}}}% - \pgf@marshal - \or % 2 = horizontal - \pgf@x=\pgf@xb% - \advance\pgf@x by-\pgf@xa% - \edef\pgf@marshal{\noexpand\pgfset{minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}% - \pgf@marshal - \or % 3 = both directions - \pgf@y=\pgf@yb% - \advance\pgf@y by-\pgf@ya% - \pgf@x=\pgf@xb% - \advance\pgf@x by-\pgf@xa% - \edef\pgf@marshal{\noexpand\pgfset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})},minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}% - \pgf@marshal - \fi - \fi -} -\tikzset{ - fit bounding box/.code={\tikz@lib@place@fit@scan{#1}{0}}, - span vertical/.code={\tikz@lib@place@fit@scan{#1}{1}}, - span horizontal/.code={\tikz@lib@place@fit@scan{#1}{2}}, - span/.code={\tikz@lib@place@fit@scan{#1}{3}}} - -\pgfmathdeclarefunction{x_node_dist}{0}{% - \begingroup - \edef\pgfmath@temp{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% - \pgfmath@temp\ifpgfutil@in@ - \expandafter\tikzext@lib@place@handle@@\tikz@node@distance\tikz@stop - \else - \let\pgf@tempb\tikz@node@distance - \fi - \pgfmathparse{\pgf@tempb}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -\pgfmathdeclarefunction{y_node_dist}{0}{% - \begingroup - \edef\pgfmath@temp{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% - \pgfmath@temp\ifpgfutil@in@ - \expandafter\tikzext@lib@place@handle@@\tikz@node@distance\tikz@stop - \else - \let\pgf@tempa\tikz@node@distance - \fi - \pgfmathparse{\pgf@tempa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -%\tikzdeclarecoordinatesystem{node distance}{% -% \tikz@cs@nd#1\tikz@stop} -%\def\tikz@cs@nd#1,#2\tikz@stop{% -% \def\tikzext@xyshift@starred@action##1{\pgftransformshift{##1}}% -% \tikzext@xyshift@starred{#1}x\pgf@tempb -% \tikzext@xyshift@starred{#2}y\pgf@tempa} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex deleted file mode 100644 index d90a2edc78..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.topaths.arcthrough.code.tex +++ /dev/null @@ -1,50 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\pgfqkeys{/tikz/arc through}{ - .unknown/.code=\pgfkeyssetevalue{/tikz/arc through/through}{\pgfkeyscurrentname}, - through/.initial={(0,0)}, - center suffix/.initial=, - clockwise/.code=% - \def\tikz@arcthrough@clockwise{% - \pgfmathsubtract@{\pgfkeysvalueof{/tikz/end angle}}{360}% - \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}}, - counter clockwise/.code=\let\tikz@arcthrough@clockwise\relax, - clockwise/.value forbidden, counter clockwise/.value forbidden, counter clockwise} -\tikzset{ - arc through/.code={% - \tikzset{every arc through/.try}% - \pgfqkeys{/tikz/arc through}{#1}% - \pgfkeysgetvalue{/tikz/arc through/through}\tikz@temp - \pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% - \expandafter\pgfextract@process\expandafter\pgf@tothrough\expandafter - {\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\tikz@temp\relax}% - \pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% - \pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% - \pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% - \pgfextract@process\pgf@tocenter{% - \pgfpointintersectionoflines - {\pgf@topointMidA}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}}% - {\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% - \pgfcoordinate{arc through center\pgfkeysvalueof{/tikz/arc through/center suffix}}{\pgf@tocenter}% - \pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% - \pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% - \pgfkeyssetevalue{/tikz/x radius}{+\pgfmathresult pt}% - \pgfkeyssetevalue{/tikz/y radius}{+\pgfmathresult pt}% - \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% - \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}% - \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% - \ifdim\pgfmathresult pt>\pgfkeysvalueof{/tikz/end angle}pt\relax - \pgfmathsubtract@{\pgfmathresult}{360}% - \fi - \pgfkeyssetevalue{/tikz/start angle}{+\pgfmathresult}% - \tikz@arcthrough@clockwise - \pgfkeyslet{/tikz/delta angle}\pgfutil@empty - \def\tikz@to@path{arc[]\tikztonodes}% - }% -} diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.transformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.transformations.mirror.code.tex deleted file mode 100644 index 026b39ab2f..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikz-ext/tikzlibraryext.transformations.mirror.code.tex +++ /dev/null @@ -1,130 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% -\usepgflibrary{ext.transformations.mirror} -\tikzset{ - mirror/.code={% - \pgfutil@in@{--}{#1}% - \ifpgfutil@in@ - \tikzext@trans@mirror#1\tikz@stop - \else - \tikz@addtransform{\tikz@scan@one@point\pgfqtransformmirror#1\relax}% - \fi}, - ymirror/.code={\pgfutil@ifnextchar(\tikzext@trans@ymirror@coordinate\tikzext@trans@ymirror@simple#1\tikz@stop}, - xmirror/.code={\pgfutil@ifnextchar(\tikzext@trans@xmirror@coordinate\tikzext@trans@xmirror@simple#1\tikz@stop}, - mirror x/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformmirror - {\expandafter\noexpand\tikz@temp} - {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} - {\noexpand\pgfqpointxy{0}{1}}}}}% - \tikz@marshal - }, - mirror y/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformmirror - {\expandafter\noexpand\tikz@temp} - {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} - {\noexpand\pgfqpointxy{1}{0}}}}}% - \tikz@marshal - }, - mirror/.value required, - ymirror/.default=+0pt, - xmirror/.default=+0pt, - mirror x/.default={(0,0)}, - mirror y/.default={(0,0)}% -} -\def\tikzext@trans@mirror#1--#2\tikz@stop{% - \tikz@addtransform{% - \pgftransformmirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} - {\tikz@scan@one@point\pgfutil@firstofone#2\relax}}} -\def\tikzext@trans@xmirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformxmirror{#1}}} -\def\tikzext@trans@ymirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformymirror{#1}}} -\def\tikzext@trans@xmirror@coordinate#1\tikz@stop{% - \tikz@scan@one@point\pgfutil@firstofone#1\relax - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformxmirror{+\the\pgf@x}% - }% - }% - \tikz@marshal -} -\def\tikzext@trans@ymirror@coordinate#1\tikz@stop{% - \tikz@scan@one@point\pgfutil@firstofone#1\relax - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformymirror{+\the\pgf@y}% - }% - }% - \tikz@marshal -} - -\tikzset{ - Mirror/.code={% - \pgfutil@in@{--}{#1}% - \ifpgfutil@in@ - \tikzext@trans@Mirror#1\tikz@stop - \else - \tikz@addtransform{\tikz@scan@one@point\pgfqtransformMirror#1\relax}% - \fi}, - yMirror/.code={\pgfutil@ifnextchar(\tikzext@trans@yMirror@coordinate\tikzext@trans@yMirror@simple#1\tikz@stop}, - xMirror/.code={\pgfutil@ifnextchar(\tikzext@trans@xMirror@coordinate\tikzext@trans@xMirror@simple#1\tikz@stop}, - Mirror x/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformMirror - {\expandafter\noexpand\tikz@temp} - {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} - {\noexpand\pgfqpointxy{0}{1}}}}}% - \tikz@marshal - }, - Mirror y/.code={% - \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformMirror - {\expandafter\noexpand\tikz@temp} - {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} - {\noexpand\pgfqpointxy{1}{0}}}}}% - \tikz@marshal - }, - Mirror/.value required, - yMirror/.default=+0pt, - xMirror/.default=+0pt, - Mirror x/.default={(0,0)}, - Mirror y/.default={(0,0)}% -} -\def\tikzext@trans@Mirror#1--#2\tikz@stop{% - \tikz@addtransform{% - \pgftransformMirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} - {\tikz@scan@one@point\pgfutil@firstofone#2\relax}}} -\def\tikzext@trans@xMirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformxMirror{#1}}} -\def\tikzext@trans@yMirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformyMirror{#1}}} -\def\tikzext@trans@xMirror@coordinate#1\tikz@stop{% - \tikz@scan@one@point\pgfutil@firstofone#1\relax - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformxMirror{+\the\pgf@x}% - }% - }% - \tikz@marshal -} -\def\tikzext@trans@yMirror@coordinate#1\tikz@stop{% - \tikz@scan@one@point\pgfutil@firstofone#1\relax - \edef\tikz@marshal{% - \noexpand\tikz@addtransform{% - \noexpand\pgftransformyMirror{+\the\pgf@y}% - }% - }% - \tikz@marshal -} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.calendar-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.calendar-plus.code.tex new file mode 100644 index 0000000000..195ecf9414 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.calendar-plus.code.tex @@ -0,0 +1,93 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\usetikzlibrary{calendar} +\pgfutil@usemodule{pgfcalendar-ext} + +% Shift between days + +\def\tikz@lib@cal@xshift{\pgfkeysvalueof{/tikz/day xshift}} +\def\tikz@lib@cal@yshift{\pgfkeysvalueof{/tikz/day yshift}} +\tikzset{day xshift/.initial=3ex,day yshift/.initial=3.5ex} + +% Shift between months + +\def\tikz@lib@cal@month@xshift{\pgfkeysvalueof{/tikz/month xshift}} +\def\tikz@lib@cal@month@yshift{\pgfkeysvalueof{/tikz/month yshift}} +\tikzset{month xshift/.initial=9ex,month yshift/.initial=9ex} + +% Internal option for storing the "width" of a calendar as a number of +% days + +\def\tikz@lib@cal@width{\pgfkeysvalueof{/tikz/tikz@lib@cal@width}} +\tikzset{tikz@lib@cal@width/.initial=1} + +% Weeks + +\def\tikzweekcode{\pgfkeysvalueof{/tikz/week code}} +\def\tikzweektext{\pgfkeysvalueof{/tikz/week text}} + +\tikzset{ + week code/.initial={% + \node[every week]{\pgfkeysvalueof{/tikz/week text}};}, + week text/.initial={\%n=}, + every week/.style=, + week label left/.style={ + every week/.append style={ + anchor=base east, + xshift=-1.25*\pgfkeysvalueof{/tikz/day xshift}}, + execute before day scope=% + \ifdate{Monday, equals=\pgfcalendarbeginiso}{\tikzweekcode}{}}} + +% +% Overwriting original \tikz@lib@cal@if@else@code +% +\def\tikz@lib@cal@if@else@code#1#2#3{% + \pgfutil@addto@macro\tikz@lib@cal@ifs{\ifdate{#1}{#2}{#3}}% + \tikz@lib@cal@scanner% +} + +% +% Overwriting original \tikz@lib@cal@stop +% +\def\tikz@lib@cal@stop{% + \pgftransformshift{\tikz@node@at}% + \expandafter\pgfcalendar\expandafter{\tikz@fig@name}{\tikz@lib@cal@start}{\tikz@lib@cal@end}% + {% + \tikz@before@day% + \scope% + \tikz@atbegin@day% + \let\pgfutil@addto@macro\pgfutil@secondoftwo + \tikz@lib@cal@ifs% + \tikzdaycode% + \tikz@atend@day% + \endscope% + \tikz@after@day% + }% + \endgroup% +} + +\def\pgfutil@addto@macro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} + +\pgfmathdeclarefunction{weeksinmonthofyear}{3}{% #1 = first weekday, #2 = month, #3 = year + \begingroup + \pgfmathlastdayinmonthofyear@{#2}{#3}% + \pgfmathadd@{#1}{\pgfmathresult}% + \pgfmathdivide@{\pgfmathresult}{7}% + \pgfmathceil@{\pgfmathresult}% + \pgfmathint@{\pgfmathresult}% + \pgfmathsmuggle\pgfmathresult + \endgroup +} +\pgfmathdeclarefunction{lastdayinmonthofyear}{2}{% #1 = month, #2 = year + \begingroup + \pgfcalendar@getlastYMX{#2}{#1}{\pgfutil@tempcnta}% + \edef\pgfmathresult{\the\pgfutil@tempcnta}% + \pgfmathsmuggle\pgfmathresult + \endgroup +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex new file mode 100644 index 0000000000..a5a982020f --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex @@ -0,0 +1,180 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\usepgflibrary{ext.pgfkeys-plus}% + +%% full arc +%% https://tex.stackexchange.com/a/144297/16595 +%% The postfix operator R is added to PGFmath, +%% it allows the use of angular segments. +%% full arc = 10 makes it so that +%% 1R = 36° +%% 2R = 72° +%% … +%% 10R = 360° +%% Calling the full arc key with an empty value +%% makes 1R = 1° +\pgfset{full arc/.code=% + \def\pgf@temp{#1}% + \ifx\pgfutil@empty\pgf@temp + \let\pgfmath@fullarc@factor\pgfutil@empty + \else + \pgfmathsetmacro\pgfmath@fullarc@factor{360/(#1)}% + \fi,full arc=} +\pgfmathdeclareoperator{R}{full arc}{1}{postfix}{950} +\pgfmathdeclarefunction{full arc}{1}{% + \begingroup + \pgfmath@x=#1pt\relax + \ifx\pgfmath@fullarc@factor\pgfutil@empty\else + \pgfmath@x\pgfmath@fullarc@factor\pgfmath@x + \fi + \pgfmath@returnone\pgfmath@x + \endgroup} + +%% foreach +%% http://tex.stackexchange.com/a/126418/16595 +%% instead of \foreach \var in {start, start + delta, ..., end} +%% this allows to use \foreach[use int={start to end step delta}] without(!) a list in {} +%% the values start, end and delta are evaluated by PGFmath at the start of the loop. +%% In addition to use int, there's also use float. +\newif\iftikzext@pgf@foreach@no@list +\pgfqkeys{/pgf/foreach}{ + use int/.code={% + \tikzext@pgf@foreach@no@list@parse@to\pgfmathtruncatemacro#1\pgffor@stop + }, + use float/.code={% + \tikzext@pgf@foreach@no@list@parse@to\pgfmathsetmacro#1\pgffor@stop + } +} + +\def\tikzext@pgf@foreach@no@list@parse@to#1#2to#3\pgffor@stop{% + \tikzext@pgf@foreach@no@listtrue + #1\foreachStart{#2}% + \pgfutil@in@{step}{#3} + \ifpgfutil@in@ + \tikzext@pgf@foreach@no@list@parse@step{#1}#3\pgffor@stop + \else + \tikzext@pgf@foreach@no@list@parse@step{#1}#3step1\pgffor@stop + \fi + \edef\tikzext@pgf@foreach@no@list@list{\foreachStart,\foreachSecond,...,\foreachEnd}% +} +\def\tikzext@pgf@foreach@no@list@parse@step#1#2step#3\pgffor@stop{% + #1\foreachEnd{#2}% + #1\foreachSecond{\foreachStart+#3}% +} +\def\pgffor@vars{% manually extended, better etoolbox + \pgfutil@ifnextchar i{\pgffor@@vars@end}{% + \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] + \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% + \iftikzext@pgf@foreach@no@list\expandafter\pgfutil@firstoftwo\else + \expandafter\pgfutil@secondoftwo\fi + {\tikzext@pgf@foreach@no@listfalse\pgffor@macro@list\tikzext@pgf@foreach@no@list@list} + {\pgffor@@vars}}}}}% + +%% PGFmath +%% strrepeat("x", 5) = "xxxxx" +\pgfmathdeclarefunction{strrepeat}{2}{% + \begingroup\pgfmathint{#2}\pgfmath@count\pgfmathresult + \let\pgfmathresult\pgfutil@empty + \pgfutil@loop\ifnum\pgfmath@count>0\relax + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% + \advance\pgfmath@count-1\relax + \pgfutil@repeat\pgfmath@smuggleone\pgfmathresult\endgroup} + +%% isInString("foo", "foobar") = true (= 1) +%% isInString("boo", "foobar") = false (= 0) +\pgfmathdeclarefunction{isInString}{2}{% + \pgfutil@in@{#1}{#2}% + \ifpgfutil@in@\def\pgfmathresult{1}\else\def\pgfmathresult{0}\fi} + +%% strcat("foo", "bar") = "foobar" (can have more than two parameters) +\pgfutil@IfUndefined{pgfmathstrcat@}{ + \pgfmathdeclarefunction{strcat}{...}{% + \begingroup + \let\pgfmathresult\pgfutil@empty + \pgfmathstrcat@@#1\pgfmath@stop} + \def\pgfmathstrcat@@#1{% + \ifx\pgfmath@stop#1% + \def\pgfmath@next{\pgfmath@smuggleone\pgfmathresult\endgroup} + \else + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult#1}% + \let\pgfmath@next\pgfmathstrcat@@ + \fi + \pgfmath@next} +}{} + +% http://tex.stackexchange.com/questions/244569/bounding-lines-around-tax-nodes/244619#244619 +\pgfmathdeclarefunction{atanXY}{2}{\pgfmathatantwo@{#2}{#1}} +\pgfmathdeclarefunction{atanYX}{2}{\pgfmathatantwo@{#1}{#2}} + +%% http://tex.stackexchange.com/a/132939/16595 +\tikzset{ + @edges through/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges through/.@cmd}} + {\pgfkeysvalueof{/tikz/@@edges through/.@cmd}[]}#1\pgfeov}}}, + @@edges through/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2) (#2)}}, + edges through/.style={/tikz/@edges through/.list={#1}}} +\tikzset{ + @edges to/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@edges to/.@cmd}} + {\pgfkeysvalueof{/tikz/@@edges to/.@cmd}[]}#1\pgfeov}}}, + @@edges to/.style args={[#1]#2}{/tikz/insert path={edge[#1] (#2)}}, + edges to/.style={/tikz/@edges to/.list={#1}}} +\tikzset{ + @tos to/.code={{{% three braces to protect \pgfeov + \pgfutil@ifnextchar[{\pgfkeysvalueof{/tikz/@@tos to/.@cmd}} + {\pgfkeysvalueof{/tikz/@@tos to/.@cmd}[]}#1\pgfeov}}}, + @@tos to/.style args={[#1]#2}{/tikz/insert path={to[#1] (#2)}}, + tos to/.style={/tikz/@tos to/.list={#1}}} + + +\pgfmathdeclarefunction{distancebetween}{2}{% only coordinates/nodes + \begingroup + \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% + \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmathveclen@\pgfmath@temp + \pgfmath@smuggleone\pgfmathresult + \endgroup} +\pgfmathdeclarefunction{qdistancebetween}{1}{% only coordinates/nodes + \begingroup + \pgfpointdiff{\pgfpointorigin}{\pgfpointanchor{#1}{center}}% + \edef\pgfmath@temp{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmathveclen@\pgfmath@temp + \pgfmath@smuggleone\pgfmathresult + \endgroup} + +\pgfmathdeclarefunction{qanglebetween}{1}{% + \pgfmathanglebetweenpoints{\pgfpointorigin}{\pgfpointanchor{#1}{center}}} + +\pgfmathdeclarefunction{anglebetween}{2}{% + \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}} + +\pgfmathdeclarefunction{isEmpty}{1}{% + \begingroup + \def\pgfmath@temp{#1}% + \pgfutil@ifxempty\pgfmath@temp{\def\pgfmathresult{1}}{\def\pgfmathresult{0}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup} + +\pgfset{ + declare constant/.code={% + \let\pgfmathdeclareconstant@@@\pgfutil@empty + \pgfkeysvalueof{/pgf/declare function/execute at begin function}% + \pgfmathdeclareconstant@#1@=@;\pgf@stop + \pgfkeysvalueof{/pgf/declare function/execute at end function}% + \pgfmathdeclareconstant@@@ + }} +\def\pgfmathdeclareconstant@{% + \pgfutil@ifnextchar x\pgfmathdeclareconstant@@\pgfmathdeclareconstant@@ +} +\def\pgfmathdeclareconstant@@#1=#2;#3\pgf@stop{% + \edef\pgfmath@local@temp{#1}% + \pgfutil@ifx\pgfmath@local@temp\pgfmath@local@at{}{% + \pgfutil@g@addto@macro\pgfmathdeclareconstant@@@{\pgfmathdeclarepseudoconstant{#1}{\def\pgfmathresult{#2}}}% + \pgfmathdeclareconstant@#3\pgf@stop + }% +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.code.tex new file mode 100644 index 0000000000..c0ecda441a --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.code.tex @@ -0,0 +1,339 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\def\tikzext@nf@align@left#1{} +\def\tikzext@nf@align@center#1{\kern.5#1} +\def\tikzext@nf@align@right#1{\kern#1} + +\pgfqkeys{/tikz/node family}{ + width/.initial=, + width/.append style={/pgf/minimum width=nf_width}, + height/.initial=, + height/.append style={/pgf/minimum height=nf_height}, + size/.code=\pgfqkeys{/tikz/node family}{width={#1},height={#1}}, + text depth/.initial=, + text height/.initial=, + text width align/.is choice, + text width align/left/.code=\let\tikzext@nf@align@action\tikzext@nf@align@left, + text width align/center/.code=\let\tikzext@nf@align@action\tikzext@nf@align@center, + text width align/right/.code=\let\tikzext@nf@align@action\tikzext@nf@align@right, + text width align=center, + text width/.initial=, + text/.code=\pgfqkeys{/tikz/node family}{text depth={#1},text height={#1},text width={#1}}, + prefix/.initial=\pgfpictureid-, +} +\tikzset{node family/.code=\pgfqkeys{/tikz/node family}{#1}} + +% #1 = family type + name +\def\tikzext@nf@save#1{% + %\errmessage{#1}% + \immediate\write\pgfutil@auxout{% + \noexpand\expandafter\noexpand\gdef\noexpand\csname tikzext@nf@#1@previous\endcsname + {\csname tikzext@nf@#1@next\endcsname}% + }% +} + +% #1 = value to set +% #2 = family type +% #3 = return dimen +\def\tikzext@nf@getandset#1#2#3{% + % what's our family's name? + #3=0pt\relax + \pgfkeysgetvalue{/tikz/node family/#2}\tikzext@nf@familyname + \pgfutil@ifxempty\tikzext@nf@familyname{% no family to deal with + }{% + \edef\tikzext@nf@familyname{\pgfkeysvalueof{/tikz/node family/prefix}\tikzext@nf@familyname}% + % we need to save the value for the next run + \pgfutil@IfUndefined{tikzext@nf@#2@\tikzext@nf@familyname @next}{% + % first time: define first value and install hook at end of picture + \expandafter\xdef\csname tikzext@nf@#2@\tikzext@nf@familyname @next\endcsname{#1}% + \edef\tikz@temp{\noexpand\tikzext@nf@save{#2@\tikzext@nf@familyname}}% + %\expandafter\AtVeryEndDocument\expandafter{\tikz@temp}% + \expandafter\pgfutil@g@addto@macro\expandafter\tikz@atend@picture\expandafter{\tikz@temp}% + }{% + \ifdim\csname tikzext@nf@#2@\tikzext@nf@familyname @next\endcsname<#1\relax + \expandafter\xdef\csname tikzext@nf@#2@\tikzext@nf@familyname @next\endcsname{#1}% + \fi + }% + \pgfutil@IfUndefined{tikzext@nf@#2@\tikzext@nf@familyname @previous}{% first run, ignore + }{% set previous value + #3=\csname tikzext@nf@#2@\tikzext@nf@familyname @previous\endcsname\relax + }% + }% +} + +\pgfdeclareshape{Rectangle}{% + \savedanchor\northeast{% + % Calculate x + % + % First, is width < minimum width? + \pgf@x=\the\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x by 2\pgf@xc% + % Qrr: family width + \tikzext@nf@getandset{\the\pgf@x}{width}{\pgfutil@tempdima}% + \ifdim\pgf@x<\pgfutil@tempdima + \pgf@x=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<\pgf@xb% + % yes, too small. Enlarge... + \pgf@x=\pgf@xb% + \fi% + % Now, calculate right border: .5\wd\pgfnodeparttextbox + .5 \pgf@x + outer sep + \pgf@x=.5\pgf@x% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \advance\pgf@x by\pgf@xa% + % Calculate y + % + % First, is height+depth < minimum height? + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y by 2\pgf@yc% + % Qrr: family height + \tikzext@nf@getandset{\the\pgf@y}{height}{\pgfutil@tempdima}% + \ifdim\pgf@y<\pgfutil@tempdima + \pgf@y=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<\pgf@yb% + % yes, too small. Enlarge... + \pgf@y=\pgf@yb% + \fi% + % Now, calculate upper border: .5\ht-.5\dp + .5 \pgf@y + outer sep + \pgf@y=.5\pgf@y% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + \advance\pgf@y by.5\ht\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \advance\pgf@y by\pgf@ya% + }% + + \savedanchor\southwest{% + % Calculate x + % + % First, is width < minimum width? + \pgf@x=\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@x by 2\pgf@xc% + % Qrr: family width + \tikzext@nf@getandset{\the\pgf@x}{width}{\pgfutil@tempdima}% + \ifdim\pgf@x<\pgfutil@tempdima + \pgf@x=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}% + \ifdim\pgf@x<\pgf@xb% + % yes, too small. Enlarge... + \pgf@x=\pgf@xb% + \fi% + % Now, calculate left border: .5\wd\pgfnodeparttextbox - .5 \pgf@x - outer sep + \pgf@x=-.5\pgf@x% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}% + \advance\pgf@x by-\pgf@xa% + % Calculate y + % + % First, is height+depth < minimum height? + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@y by 2\pgf@yc% + % Qrr: family height + \tikzext@nf@getandset{\the\pgf@y}{height}{\pgfutil@tempdima}% + \ifdim\pgf@y<\pgfutil@tempdima + \pgf@y=\pgfutil@tempdima + \fi + % + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@y<\pgf@yb% + % yes, too small. Enlarge... + \pgf@y=\pgf@yb% + \fi% + % Now, calculate upper border: .5\ht-.5\dp - .5 \pgf@y - outer sep + \pgf@y=-.5\pgf@y% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + \advance\pgf@y by.5\ht\pgfnodeparttextbox% + \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% + \advance\pgf@y by-\pgf@ya% + }% + \inheritbackgroundpath[from=rectangle] + \inheritbeforebackgroundpath[from=rectangle] + \inheritbehindforegroundpath[from=rectangle] + \inheritforegroundpath[from=rectangle] + \inheritbeforeforegroundpath[from=rectangle] + \inheritanchor[from=rectangle]{center} + \inheritanchor[from=rectangle]{mid} + \inheritanchor[from=rectangle]{base} + \inheritanchor[from=rectangle]{north} + \inheritanchor[from=rectangle]{south} + \inheritanchor[from=rectangle]{west} + \inheritanchor[from=rectangle]{mid west} + \inheritanchor[from=rectangle]{base west} + \inheritanchor[from=rectangle]{north west} + \inheritanchor[from=rectangle]{south west} + \inheritanchor[from=rectangle]{east} + \inheritanchor[from=rectangle]{mid east} + \inheritanchor[from=rectangle]{base east} + \inheritanchor[from=rectangle]{north east} + \inheritanchor[from=rectangle]{south east} + \inheritanchorborder[from=rectangle] +} + +\pgfdeclareshape{Circle}{% + \savedanchor\centerpoint{% tex/generic/pgf/modules/pgfmoduleshapes.code.tex + \pgf@x=.5\wd\pgfnodeparttextbox + \pgf@y=.5\ht\pgfnodeparttextbox + \advance\pgf@y by-.5\dp\pgfnodeparttextbox + }% + \saveddimen\radius{% tex/generic/pgf/modules/pgfmoduleshapes.code.tex + % Calculate ``height radius'' + \pgf@ya=.5\ht\pgfnodeparttextbox + \advance\pgf@ya by.5\dp\pgfnodeparttextbox + \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% + \advance\pgf@ya by\pgf@yb + % Calculate ``width radius'' + \pgf@xa=.5\wd\pgfnodeparttextbox + \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% + \advance\pgf@xa by\pgf@xb + % Calculate length of radius vector: + \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% + \ifdim\pgf@x>\pgf@y + \c@pgf@counta=\pgf@x + \ifnum\c@pgf@counta=0\relax + \else + \divide\c@pgf@counta by 255\relax + \pgf@xa=16\pgf@xa\relax + \divide\pgf@xa by\c@pgf@counta + \pgf@xa=16\pgf@xa\relax + \fi + \else + \c@pgf@counta=\pgf@y + \ifnum\c@pgf@counta=0\relax + \else + \divide\c@pgf@counta by 255\relax + \pgf@ya=16\pgf@ya\relax + \divide\pgf@ya by\c@pgf@counta + \pgf@xa=16\pgf@ya\relax + \fi + \fi + \pgf@x=\pgf@xa% + % Qrr: check for families + \tikzext@nf@getandset{\the\dimexpr2\pgf@x\relax}{width}{\pgfutil@tempdima}% + \tikzext@nf@getandset{\the\dimexpr2\pgf@x\relax}{height}{\pgfutil@tempdimb}% + % Qrr: and adjust like minimum width and minimum height + \ifdim\pgf@x<.5\pgfutil@tempdima + \pgf@x=.5\pgfutil@tempdima + \fi + \ifdim\pgf@x<.5\pgfutil@tempdimb + \pgf@x=.5\pgfutil@tempdimb + \fi + % If necessary, adjust radius so that the size requirements are met: + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% + \ifdim\pgf@x<.5\pgf@xb + \pgf@x=.5\pgf@xb + \fi + \ifdim\pgf@x<.5\pgf@yb + \pgf@x=.5\pgf@yb + \fi + % Now, add larger of outer separations. + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \ifdim\pgf@xb<\pgf@yb + \advance\pgf@x by\pgf@yb + \else + \advance\pgf@x by\pgf@xb + \fi + }% + \inheritbackgroundpath[from=circle] + \inheritbeforebackgroundpath[from=circle] + \inheritbehindforegroundpath[from=circle] + \inheritforegroundpath[from=circle] + \inheritbeforeforegroundpath[from=circle] + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{south east} + \inheritanchorborder[from=circle] +} + +\def\pgfutil@prefixto@macro#1#2{% + \def\pgf@temp{#2}% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter#1% + \expandafter\expandafter\expandafter{\expandafter\pgf@temp#1}% +} + +\pgfqkeys{/tikz/node family}{ + setup shape/.code={% + \expandafter\pgfutil@prefixto@macro\csname pgf@sh@s@#1\endcsname{% + \tikzext@nf@getandset{\the\wd\pgfnodeparttextbox}{text width}{\pgfutil@tempdima}% + \ifdim\wd\pgfnodeparttextbox<\pgfutil@tempdima + \pgfutil@tempdimb=\pgfutil@tempdima + \advance\pgfutil@tempdimb-\wd\pgfnodeparttextbox + \setbox\pgfnodeparttextbox=\hbox to \pgfutil@tempdima{\tikzext@nf@align@action\pgfutil@tempdimb\unhbox\pgfnodeparttextbox}% + \fi + \tikzext@nf@getandset{\the\dp\pgfnodeparttextbox}{text depth}{\pgfutil@tempdima}% + \ifdim\dp\pgfnodeparttextbox<\pgfutil@tempdima + \dp\pgfnodeparttextbox=\pgfutil@tempdima + \fi + \tikzext@nf@getandset{\the\ht\pgfnodeparttextbox}{text height}{\pgfutil@tempdima}% + \ifdim\ht\pgfnodeparttextbox<\pgfutil@tempdima + \ht\pgfnodeparttextbox=\pgfutil@tempdima + \fi + }% + }, + setup shape/.list={rectangle,circle,Rectangle,Circle} +} + +%% nf functions +\def\tikzext@nf@function@default{{\the\pgf@x}{\the\pgf@y}} +\def\tikzext@nf@function@default@double{{\the\dimexpr2\pgf@x\relax}{\the\dimexpr2\pgf@y\relax}} +\def\tikzext@nf@function@circle{{\the\pgf@x}{\the\pgf@x}} +\def\tikzext@nf@function@circle@double{{\the\dimexpr2\pgf@x\relax}{\the\dimexpr2\pgf@x\relax}} + +\pgfmathdeclarefunction{nf_width}{0}{% + \begingroup + \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name}{% + \let\tikzext@nf@function\tikzext@nf@function@default + }{% + \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name @extra}{}{\csname tikzext@nf@function@\pgf@sm@shape@name @extra\endcsname}% + \expandafter\let\expandafter\tikzext@nf@function\csname tikzext@nf@function@\pgf@sm@shape@name\endcsname + }% + \tikzext@nf@getandset{\expandafter\pgfutil@firstoftwo\tikzext@nf@function}{width}{\pgfutil@tempdima}% + \edef\pgfmathresult{\pgf@sys@tonumber\pgfutil@tempdima}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\pgfmathdeclarefunction{nf_height}{0}{% + \begingroup + \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name}{% + \let\tikzext@nf@function\tikzext@nf@function@default + }{% + \pgfutil@IfUndefined{tikzext@nf@function@\pgf@sm@shape@name @extra}{}{\csname tikzext@nf@function@\pgf@sm@shape@name @extra\endcsname}% + \expandafter\let\expandafter\tikzext@nf@function\csname tikzext@nf@function@\pgf@sm@shape@name\endcsname + }% + \tikzext@nf@getandset{\expandafter\pgfutil@secondoftwo\tikzext@nf@function}{height}{\pgfutil@tempdima}% + \edef\pgfmathresult{\pgf@sys@tonumber\pgfutil@tempdima}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.shapes.geometric.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.shapes.geometric.code.tex new file mode 100644 index 0000000000..58384960a8 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.node-families.shapes.geometric.code.tex @@ -0,0 +1,38 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\usetikzlibrary{ext.node-families,shapes.geometric} + +\let\tikzext@nf@function@ellipse \tikzext@nf@function@default@double +\let\tikzext@nf@function@star \tikzext@nf@function@circle +\let\tikzext@nf@function@diamond \tikzext@nf@function@default@double +\let\tikzext@nf@function@star \tikzext@nf@function@circle@double +\expandafter\let\csname tikzext@nf@function@regular polygon\endcsname + \tikzext@nf@function@circle@double +\let\tikzext@nf@function@trapezium\tikzext@nf@function@default@double +\def\tikzext@nf@function@semicircle {{\the\dimexpr2\pgf@x\relax}{\the\pgf@x}} +\expandafter\def\csname tikzext@nf@function@isosceles triangle\endcsname + {{\the\dimexpr2\pgf@ya\relax}{\the\pgf@xa}} +\def\tikzext@nf@function@kite {{\the\dimexpr2\pgf@xa\relax}{\the\dimexpr\pgf@ya+\pgf@yb\relax}} +\def\tikzext@nf@function@dart {{\the\dimexpr2\pgf@ya\relax}{\the\pgf@xb}} +\expandafter\def\csname tikzext@nf@function@circular sector\endcsname{{\the\pgf@xc}{\the\pgf@xa}} +\def\tikzext@nf@function@cylinder{{\the\dimexpr2\pgfutil@tempdimb\relax}{\the\pgf@x}} + +\tikzset{node family/setup shape/.list={ + ellipse, + star, + diamond, + regular polygon, + trapezium, + semicircle, + isosceles triangle, + kite, + dart, + circular sector, + cylinder +}} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.arcto.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.arcto.code.tex new file mode 100644 index 0000000000..e97bbf939d --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.arcto.code.tex @@ -0,0 +1,326 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\tikzset{ + arc to/.code=\pgfqkeys{/tikz/arc to}{#1}, + arc to={ + counter clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{1}, + clockwise/.code=\pgfkeyssetvalue{/tikz/arc to/ccw flag}{0}, + x radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}, + y radius/.code=\pgfkeyssetvalue{/tikz/y radius}{#1}, + radius/.code=\pgfkeyssetvalue{/tikz/x radius}{#1}\pgfkeyssetvalue{/tikz/y radius}{#1}, + large/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{1}, + small/.code=\pgfkeyssetvalue{/tikz/arc to/large flag}{0}, + % defaults + rotate/.initial=0, counter clockwise, small, + counter clockwise/.value forbidden, + clockwise/.value forbidden, + large/.value forbidden, + small/.value forbidden}} +\def\tikz@arcA rc{\pgfutil@ifnextchar t% + {\tikz@flush@moveto\expandafter\expandafter\expandafter\tikz@arcB@cont\expandafter\pgfutil@gobble\pgfutil@gobble} + {\tikz@flush@moveto\tikz@arc@cont}} +\def\tikz@arcB@cont{% + \pgfutil@ifnextchar[\tikz@@do@arcB{ + \advance\tikz@expandcount by -10\relax% go down quickly + \ifnum\tikz@expandcount<0\relax% + \def\@next{\tikz@@do@arcB[]}% + \else% + \def\@next{\expandafter\tikz@arcB@cont}% + \fi% + \@next}}% +\def\tikz@@do@arcB[#1]{% + \def\tikz@arcB@options{#1}% + \tikz@do@@arcB} +\def\tikz@do@@arcB{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@do@@arcB} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@do@@arcB} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikz@do@@arcB} + {\tikz@scan@one@point\tikz@do@arcB}}}} + +\def\tikz@do@arcB#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \iftikz@shapeborder + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \fi + \begingroup + \tikzset{every arc/.try,every arc to/.try,arc to/.expand once=\tikz@arcB@options}% + \pgfmathsetmacro\tikz@arc@x{\pgfkeysvalueof{/tikz/x radius}}% + \ifpgfmathunitsdeclared + \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% + \ifpgfmathunitsdeclared + \tikzext@pgfpatharcto{\tikz@arc@x pt}{\tikz@arc@y pt} + {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} + {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% + \else + \tikzerror{You cannot mix dimensions and dimension values in an arc}% + \fi + \else + \pgfmathsetmacro\tikz@arc@y{\pgfkeysvalueof{/tikz/y radius}}% + \ifpgfmathunitsdeclared + \tikzerror{You cannot mix dimensions and dimension values in an arc}% + \else + \pgf@process{\pgfpointxy{\tikz@arc@x}{0}}% + \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + \let\tikz@arc@x\pgfmathresult + \pgf@process{\pgfpointxy{0}{\tikz@arc@y}}% + \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}% + \let\tikz@arc@y\pgfmathresult + \tikzext@pgfpatharcto{+\tikz@arc@x pt}{+\tikz@arc@y pt} + {\pgfkeysvalueof{/tikz/arc to/rotate}}{\pgfkeysvalueof{/tikz/arc to/large flag}} + {\pgfkeysvalueof{/tikz/arc to/ccw flag}}{#1}% + \fi + \fi + \endgroup + % check whether \pgf@marshall starts with \pgfpathlineto + \pgfutil@ifxempty\pgf@marshal{}{% + \edef\tikz@temp{\expandafter\expandafter\expandafter\noexpand\expandafter\pgfutil@firstgobblerest\pgf@marshal\relax}% + \expandafter\let\expandafter\tikz@temp\tikz@temp + \pgfutil@ifx\tikz@temp\pgfpathlineto{}{% + % getting rid of \pgfpatharcaxes inside \pgf@marshal + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@marshal + \expandafter\expandafter\expandafter{\expandafter\pgfutil@gobble\pgf@marshal}% + % extracting the other four values needed for the timer + \edef\tikz@timer@start@angle{\expandafter\pgfutil@firstoffour\pgf@marshal}% + \edef\tikz@timer@end@angle{\expandafter\pgfutil@secondoffour\pgf@marshal}% + \pgfextract@process\tikz@timer@zero@axis{\expandafter\pgfutil@thirdoffour\pgf@marshal}% + \pgfextract@process\tikz@timer@ninety@axis{\expandafter\pgfutil@fourthoffour\pgf@marshal}% + % + \let\tikz@timer=\tikz@timer@arc + }% + }% + \tikz@scan@next@command +} +\def\pgfutil@firstoffour#1#2#3#4{#1} +\def\pgfutil@secondoffour#1#2#3#4{#2} +\def\pgfutil@thirdoffour#1#2#3#4{#3} +\def\pgfutil@fourthoffour#1#2#3#4{#4} +\def\pgfutil@firstgobblerest#1#2\relax{#1} + +% original from pgfcorepathconstruct.code.tex +\def\tikzext@pgfpatharcto#1#2#3#4#5#6{% + {% + % The following code is based on the transformation described in svg + % 1.1 specification Section F.6.5 + % + % Step 1: store the simple parameters (xa=x1 since TeX does not + % allow numbers in names) + % + \pgfmathsetmacro\pgf@arcto@rx{abs(#1)}% + \pgfmathsetmacro\pgf@arcto@ry{abs(#2)}% + \ifdim\pgf@arcto@rx pt=0pt% special rule: zero radius=straight line + \gdef\pgf@marshal{\pgfpathlineto{#6}}% + \else + \ifdim\pgf@arcto@ry pt=0pt% special rule: zero radius=straight line + \gdef\pgf@marshal{\pgfpathlineto{#6}}% + \else + \pgfmathsetmacro\pgf@arcto@phi{#3}% + \pgfmathsetmacro\pgf@arcto@fA{#4}% + \ifdim\pgf@arcto@fA pt=0pt + \else + \pgfmathsetmacro\pgf@arcto@fA{1.0}% Special rule: every non-zero value is 1. + \fi + \pgfmathsetmacro\pgf@arcto@fS{#5}% + \ifdim\pgf@arcto@fS pt=0pt + \else + \pgfmathsetmacro\pgf@arcto@fS{1.0}% Special rule: every non-zero value is 1. + \fi + \pgf@process{#6}% + \edef\pgf@arcto@xb{\the\pgf@x}% + \edef\pgf@arcto@yb{\the\pgf@y}% + % + % Step 2: x1,y1 is more complicated to compute: It is given by lastx + % and lasty, but these are transformed coordinates, we need the + % untransformed ones. So, we inverse the transformation (arghh...) + % + \pgftransforminvert% + \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}}% + \edef\pgf@arcto@xa{\the\pgf@x}% + \edef\pgf@arcto@ya{\the\pgf@y}% + \edef\pgf@temp@a{\pgf@arcto@xa,\pgf@arcto@ya}% + \edef\pgf@temp@b{\pgf@arcto@xb,\pgf@arcto@yb}% + \ifx\pgf@temp@a\pgf@temp@b% special rule: skip! + \global\let\pgf@marshal\pgfutil@empty + \else + % + % Ok, now we got all the parameters setup. Now comes the + % computation... + % + % + % Step 3: Start with a new coordinate system and rotate everything + % by the negated phi. + % + \pgftransformreset + \pgftransformrotate{-\pgf@arcto@phi}% + % Ok, using \pgfpointtransformed we now get transformed points... + % + % Step 4: Compute x1' and y1' (xaprime and yaprime) + % + \pgf@process{% + \pgfpointtransformed{\pgfpointscale{.5}{\pgfpointdiff + {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}} + {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}}% + }% + }% + }% + \edef\pgf@arcto@xaprime{\pgf@sys@tonumber\pgf@x}% + \edef\pgf@arcto@yaprime{\pgf@sys@tonumber\pgf@y}% + % + % Compute Lambda + % + \pgfmathsetmacro\pgf@arcto@frac@x{\pgf@arcto@xaprime/\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@frac@y{\pgf@arcto@yaprime/\pgf@arcto@ry}% + \pgfmathsetmacro\pgf@arcto@lambda{ + \pgf@arcto@frac@x*\pgf@arcto@frac@x+\pgf@arcto@frac@y*\pgf@arcto@frac@y + }% + \ifdim\pgf@arcto@lambda pt>1pt + \pgfmathsetmacro\pgf@arcto@sqrt@lambda{sqrt(\pgf@arcto@lambda)}% + \pgfmathsetmacro\pgf@arcto@rx{\pgf@arcto@sqrt@lambda*\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@ry{\pgf@arcto@sqrt@lambda*\pgf@arcto@ry}% + \fi + % + % Do some scaling + % + \pgfmathsetmacro\pgf@arcto@xaprime@abs{abs(\pgf@arcto@xaprime)}% + \pgfmathsetmacro\pgf@arcto@yaprime@abs{abs(\pgf@arcto@yaprime)}% + \pgfmathmax@{\pgf@arcto@rx,\pgf@arcto@ry,\pgf@arcto@xaprime@abs,\pgf@arcto@yaprime@abs}% + \pgfmathsetmacro\pgf@arcto@scaling{20/\pgfmathresult}% + \pgfmathsetmacro\pgf@arcto@rx@scaled{\pgf@arcto@scaling*\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@ry@scaled{\pgf@arcto@scaling*\pgf@arcto@ry}% + \pgfmathsetmacro\pgf@arcto@xaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@xaprime}% + \pgfmathsetmacro\pgf@arcto@yaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@yaprime}% + % + % Step 5: Now comes the messy computation of c1' and c2'. + % + \ifdim\pgf@arcto@rx pt>\pgf@arcto@ry pt + \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry}% + \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime@scaled}% + \pgfmathsetmacro\pgf@arcto@numerator{ + \pgf@arcto@ry@scaled*\pgf@arcto@ry@scaled- + \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled- + \pgf@arcto@temp*\pgf@arcto@temp + }% + \pgfmathsetmacro\pgf@arcto@denominator{ + \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled+ + \pgf@arcto@temp*\pgf@arcto@temp + }% + \else + \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry}% + \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime@scaled}% + \pgfmathsetmacro\pgf@arcto@numerator{ + \pgf@arcto@rx@scaled*\pgf@arcto@rx@scaled- + \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled- + \pgf@arcto@temp*\pgf@arcto@temp + }% + \pgfmathsetmacro\pgf@arcto@denominator{ + \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled+ + \pgf@arcto@temp*\pgf@arcto@temp + }% + \fi + \pgfmathsetmacro\pgf@arcto@frac{ + \pgf@arcto@numerator/\pgf@arcto@denominator + }% + \ifdim\pgf@arcto@frac pt<0pt + \pgfmathsetmacro\pgf@arcto@factor{0}% + \else + \pgfmathsetmacro\pgf@arcto@factor{sqrt(\pgf@arcto@frac)}% + \fi + \ifx\pgf@arcto@fA\pgf@arcto@fS + \pgfmathsetmacro\pgf@arcto@factor{-\pgf@arcto@factor}% + \fi + \pgfmathsetmacro\pgf@arcto@cxprime{ + \pgf@arcto@factor*\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime + }% + \pgfmathsetmacro\pgf@arcto@cyprime{ + -\pgf@arcto@factor*\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime + }% + % + % Step 6: Ok, now compute cx,cy + % + \pgftransformreset + \pgftransformrotate{\pgf@arcto@phi}% + \pgf@process{% + \pgfpointtransformed{\pgfqpoint{\pgf@arcto@cxprime pt}{\pgf@arcto@cyprime pt}}% + }% + \edef\pgf@arcto@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgf@process{\pgfpointadd{\pgf@arcto@temp}{% + \pgfpointscale{.5}{% + \pgfpointadd + {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}} + {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}}}% + }% + }% + \edef\pgf@arcto@cx{\the\pgf@x}% + \edef\pgf@arcto@cy{\the\pgf@y}% + % + % Step 7: Compute start angle: + % + \pgfmathsetmacro\pgf@arcto@vec@x{(\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@vec@y{(\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry}% + \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)}% + \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator}% + \pgfmathsetmacro\pgf@arcto@theta@start{acos(\pgf@arcto@frac)}% + \ifdim\pgf@arcto@vec@y pt<0pt + \pgfmathsetmacro\pgf@arcto@theta@start{-\pgf@arcto@theta@start}% + \fi + % + % Step 8: Compute end angle: + % + \pgfmathsetmacro\pgf@arcto@vec@x{(-\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx}% + \pgfmathsetmacro\pgf@arcto@vec@y{(-\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry}% + \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)}% + \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator}% + \pgfmathsetmacro\pgf@arcto@theta@end{acos(\pgf@arcto@frac)}% + \ifdim\pgf@arcto@vec@y pt<0pt + \pgfmathsetmacro\pgf@arcto@theta@end{-\pgf@arcto@theta@end}% + \fi + \pgfmathsetmacro\pgf@arcto@delta@theta{abs(\pgf@arcto@theta@start-\pgf@arcto@theta@end)}% + \ifdim\pgf@arcto@fA pt=0pt + \ifdim\pgf@arcto@delta@theta pt>180pt + % Ok, we need to adjust the angle! + \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}% + \else + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}% + \fi + \fi + \else + \ifdim\pgf@arcto@delta@theta pt<180pt + % Ok, we need to adjust the angle! + \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}% + \else + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}% + \fi + \fi + \fi + % Qrr: + % make sure direction is properly followed + \ifdim\pgf@arcto@fS pt=1pt + % counter clockwise + \ifdim\pgf@arcto@theta@end pt<\pgf@arcto@theta@start pt + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}% + \fi + \else + % clockwise + \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}% + \fi + \fi + \xdef\pgf@marshal{\noexpand + \pgfpatharcaxes{\pgf@arcto@theta@start}{\pgf@arcto@theta@end} + {\noexpand\pgfpointpolar{\pgf@arcto@phi}{\pgf@arcto@rx}} + {\noexpand\pgfpointpolar{\pgf@arcto@phi+90}{\pgf@arcto@ry}}% + }% + \fi\fi\fi + }% + \pgf@marshal +} \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.ortho.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.ortho.code.tex new file mode 100644 index 0000000000..216d3e74e3 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.ortho.code.tex @@ -0,0 +1,693 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +%% For the operators r-lr, r-rl, r-ud and r-du we need to check after TikZ found r +\let\tikz@orig@rect\tikz@rect +\def\tikz@rect{\pgfutil@ifnextchar e\tikz@orig@rect\tikzext@tikz@r} +\def\tikzext@tikz@r -{% + \pgfutil@ifnextchar l\tikzext@tikz@lr@lineto{% + \pgfutil@ifnextchar r\tikzext@tikz@rl@lineto{% + \pgfutil@ifnextchar u\tikzext@tikz@ud@lineto{% + \pgfutil@ifnextchar d\tikzext@tikz@du@lineto\tikz@expand + }% + }% + }% +} +%% For the operator |-| we need to check after TikZ found |- +\let\tikz@orig@vh@lineto@next\tikz@vh@lineto@next +\def\tikz@vh@lineto@next{% + \pgfutil@ifnextchar|{\expandafter\tikzext@tikz@vhv@lineto\pgfutil@gobble}% + {\pgfutil@ifnextchar\tikz@activebar{\expandafter\tikzext@tikz@vhv@lineto\pgfutil@gobble}% + {\tikz@orig@vh@lineto@next}}} +%% For the operator -|- we need to check after TikZ found -| +\let\tikz@orig@hv@lineto\tikz@hv@lineto +\def\tikz@hv@lineto{% + \pgfutil@ifnextchar-{\expandafter\tikzext@tikz@hvh@lineto\pgfutil@gobble}% + {\tikz@orig@hv@lineto}} + +%% |-|[] and -|-[] are allowed +\def\tikzext@tikz@vhv@lineto{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@vhv@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@vhv@lineto@next[]}} +\def\tikzext@tikz@hvh@lineto{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@hvh@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@hvh@lineto@next[]}} + +%% r-rl[], r-lr[], etc. +\def\tikzext@tikz@rl@lineto rl{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@rl@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@rl@lineto@next[]}} +\def\tikzext@tikz@lr@lineto lr{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@lr@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@lr@lineto@next[]}} +\def\tikzext@tikz@du@lineto du{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@du@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@du@lineto@next[]}} +\def\tikzext@tikz@ud@lineto ud{\pgfutil@ifnextchar[{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@ud@lineto@next}{\tikzext@tikz@collect@hvvh@options\tikzext@tikz@ud@lineto@next[]}} + +%% TikZ interjects are done, the rest is independent: + + +\newdimen\tikzext@tikz@udlr@distance +\newdimen\tikzext@tikz@hvvh@distance +\newif\iftikzext@tikz@hvvh@middle % checks whether spacing = 0 was selected +\newif\iftikzext@tikz@hvvh@fromcenter +\newif\iftikzext@ortho@preflush +\tikzext@ortho@preflushtrue + +%%% HVVH/UDLR +\tikzset{% + ortho/.code=\pgfqkeys{/tikz/ortho}{#1}, + hvvh/.code=\pgfqkeys{/tikz/ortho}{#1},% + udlr/.code=\pgfqkeys{/tikz/ortho}{#1},% + ortho/.search also=/tikz, + ortho/middle 0 to 1/.style={/tikz/ortho/spacing=0},% + ortho/from center/.is if=tikzext@tikz@hvvh@fromcenter,% + ortho/spacing/.code=% spacing = 0 means that the middle part are the pos-itions 0 to 1, + % the first part is -1 to 0, the last part is to 2 + \pgfmathint{#1}\let\tikzext@tikz@hvvh@timing@parts\pgfmathresult% in case they are calculations to be done + \ifcase\tikzext@tikz@hvvh@timing@parts\relax + \tikzext@tikz@hvvh@middletrue + \def\tikzext@tikz@hvvh@timing@parts{1}% + \def\tikzext@tikz@hvvh@timing@first{0}% + \def\tikzext@tikz@hvvh@timing@last{1}% + \def\tikzext@tikz@hvvh@timing@subtr{0}% + \def\tikzext@tikz@hvvh@timing@factor{1}% + \else % in all other cases n > 0 the kinks are at pos = 1/n and (n - 1)/n + \tikzext@tikz@hvvh@middlefalse + \pgfmathreciprocal{#1}\let\tikzext@tikz@hvvh@timing@first\pgfmathresult + \pgfmathsetmacro\tikzext@tikz@hvvh@timing@last{1-\pgfmathresult}% + \pgfmathreciprocal{#1-2}% + \let\tikzext@tikz@hvvh@timing@subtr\pgfmathresult + \pgfmathsetmacro\tikzext@tikz@hvvh@timing@factor{1+2*\pgfmathresult}% + \fi,% + ortho/ratio/.code=\pgfmathsetmacro\tikzext@tikz@hvvh@ratio{#1},% + % TODO: not possible to do distance in TikZ coordinate system + ortho/distance/.code=\pgfmathsetlength\tikzext@tikz@hvvh@distance{#1}\let\tikzext@tikz@hvvh@ratio\pgfutil@empty,% + ortho/udlr distance/.style={% + /tikz/ortho/ud distance={#1},% + /tikz/ortho/du distance={#1},% + /tikz/ortho/lr distance={#1},% + /tikz/ortho/rl distance={#1}},% + ortho/ud distance/.initial=+.5cm,% + ortho/du distance/.initial=+.5cm,% + ortho/lr distance/.initial=+.5cm,% + ortho/rl distance/.initial=+.5cm,% + ortho/ratio=.5,% default value + ortho/spacing=4,% default value +}% + +%BEGIN_FOLD Timer +\def\tikz@timer@hvhline{% + \pgf@process{\tikz@timer@start}\pgf@ya\pgf@y + \pgf@process{\tikz@timer@end}\pgf@yc\pgf@y + \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% + \ifdim\tikz@time pt<\tikzext@tikz@hvvh@timing@first pt% first quarter + \iftikzext@tikz@hvvh@middle + \advance\pgf@xb1pt% + \else + \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb + \fi + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% + \else + \ifdim\tikz@time pt>\tikzext@tikz@hvvh@timing@last pt% last quarter + \iftikzext@tikz@hvvh@middle + \advance\pgf@xb-1pt% + \else + \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb + \fi + \advance\pgf@xb\dimexpr-\tikzext@tikz@hvvh@timing@parts pt+1pt\relax% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@yc}}{\noexpand\tikz@timer@end}}% + \else% middle half + \pgf@xb\tikzext@tikz@hvvh@timing@factor\pgf@xb% + \advance\pgf@xb-\tikzext@tikz@hvvh@timing@subtr pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@middle}}% + \fi\fi\tikz@marshal} +\def\tikz@timer@vhvline{% + \pgf@process{\tikz@timer@start}\pgf@xa\pgf@x + \pgf@process{\tikz@timer@end}\pgf@xc\pgf@x + \pgf@process{\tikz@timer@middle}\pgf@xb\tikz@time pt% + \ifdim\tikz@time pt<\tikzext@tikz@hvvh@timing@first pt% first quarter + \iftikzext@tikz@hvvh@middle + \advance\pgf@xb1pt% + \else + \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb + \fi + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% + \else + \ifdim\tikz@time pt>\tikzext@tikz@hvvh@timing@last pt% last quarter + \iftikzext@tikz@hvvh@middle + \advance\pgf@xb-1pt% + \else + \pgf@xb\tikzext@tikz@hvvh@timing@parts\pgf@xb + \fi + \advance\pgf@xb by\dimexpr-\tikzext@tikz@hvvh@timing@parts pt+1pt\relax% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% + \else% middle half + \pgf@xb=\tikzext@tikz@hvvh@timing@factor\pgf@xb + \advance\pgf@xb by-\tikzext@tikz@hvvh@timing@subtr pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@middle}}% + \fi\fi\tikz@marshal}% + +%% collect options and nodes, coordinates and pics onpath +\let\tikz@hvvh@currentoption\pgfutil@empty +\def\tikzext@tikz@collect@hvvh@options#1[#2]{\edef\tikz@hvvh@currentoption{#2}#1} +\def\tikzext@tikz@hvh@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@hvh@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@hvh@lineto@next}% + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@hvh@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@hvh@lineto}}}}% +\def\tikzext@tikz@vhv@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@vhv@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@vhv@lineto@next}% + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@vhv@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@vhv@lineto}}}}% +\def\tikzext@tikz@ud@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@ud@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@ud@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@ud@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@ud@lineto}}}}% +\def\tikzext@tikz@du@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@du@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@du@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@du@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@du@lineto}}}}% +\def\tikzext@tikz@lr@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@lr@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@lr@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@lr@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@lr@lineto}}}}% +\def\tikzext@tikz@rl@lineto@next{% + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikzext@tikz@rl@lineto@next} + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikzext@tikz@rl@lineto@next} + {\pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikzext@tikz@rl@lineto@next}{\tikz@scan@one@point\tikzext@tikz@@rl@lineto}}}}% + +\def\tikz@do@hvvh#1#2#3#4#5{% +% #1 = first kink +% #2 = second kink +% #3 = end +% #4 = timer +% #5 = tikz@shapeborder@name + \pgfpathlineto{#1}% + \pgfpathlineto{#2}% + \pgfpathlineto{#3}% + \def\tikz@timer@middle{#2}% + \def\tikz@timer@end{#3}% + \let\tikz@timer#4 + \edef\pgf@temp{#5}% + \ifx\pgf@temp\pgfutil@empty + \let\tikz@moveto@waiting\relax + \else + \let\tikz@moveto@waiting\pgf@temp + \fi + \tikz@scan@next@command}% + +%% -|- operator +\def\tikzext@tikz@@hvh@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb=\tikz@lastx + \pgf@xc=\tikz@lastx + \pgf@yc=\tikz@lasty + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@xc\pgf@yc + \begingroup + \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \iftikz@shapeborder + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xb}{\tikz@lasty}}}% + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \fi + \pgfutil@ifxempty\tikzext@tikz@hvvh@ratio{% + \ifdim\tikzext@tikz@hvvh@distance<0pt\relax + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc\tikz@lastx + \else + \pgf@xc\pgf@x + \fi + \fi + \ifdim\pgf@xb>\tikz@lastx + \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance + \fi + }{% + \iftikzext@tikz@hvvh@fromcenter + \tikzext@tikz@hvvh@distance\tikz@lastx + \else + \tikzext@tikz@hvvh@distance\pgf@x + \fi + \advance\tikzext@tikz@hvvh@distance-\pgf@xc + \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance + }% + \advance\pgf@xc\tikzext@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \fi + \pgfutil@ifxempty\tikzext@tikz@hvvh@ratio{% + \ifdim\tikzext@tikz@hvvh@distance<0pt\relax + \pgf@xc\tikz@lastx + \fi + \ifdim\pgf@xb>\tikz@lastx + \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance + \fi + }{% + \tikzext@tikz@hvvh@distance\tikz@lastx + \advance\tikzext@tikz@hvvh@distance-\pgf@xc + \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance + }% + \advance\pgf@xc\tikzext@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\expandafter\noexpand\pgf@tempa}% + {\expandafter\noexpand\pgf@tempb}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% |-| operator +\def\tikzext@tikz@@vhv@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc=\tikz@lastx + \pgf@yb=\tikz@lasty + \pgf@yc=\tikz@lasty + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@yc + \begingroup + \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \iftikz@shapeborder + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yb}}}% + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \fi + \ifx\tikzext@tikz@hvvh@ratio\pgfutil@empty + \ifdim\tikzext@tikz@hvvh@distance<0pt\relax + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc\tikz@lasty + \else + \pgf@yc\pgf@y + \fi + \fi + \ifdim\pgf@yb>\tikz@lasty + \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance + \fi + \else + \iftikzext@tikz@hvvh@fromcenter + \tikzext@tikz@hvvh@distance\tikz@lasty + \else + \tikzext@tikz@hvvh@distance\pgf@y + \fi + \advance\tikzext@tikz@hvvh@distance-\pgf@yc + \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance + \fi + \advance\pgf@yc\tikzext@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + \edef\pgf@temp{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \fi + \ifx\tikzext@tikz@hvvh@ratio\pgfutil@empty + \ifdim\tikzext@tikz@hvvh@distance<0pt\relax + \pgf@yc\tikz@lasty + \fi + \ifdim\pgf@yb>\tikz@lasty + \tikzext@tikz@hvvh@distance-\tikzext@tikz@hvvh@distance + \fi + \else + \tikzext@tikz@hvvh@distance\tikz@lasty + \advance\tikzext@tikz@hvvh@distance-\pgf@yc + \tikzext@tikz@hvvh@distance\tikzext@tikz@hvvh@ratio\tikzext@tikz@hvvh@distance + \fi + \advance\pgf@yc\tikzext@tikz@hvvh@distance + \edef\pgf@tempa{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@tempb{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + \edef\pgf@temp{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\expandafter\noexpand\pgf@tempa}% + {\expandafter\noexpand\pgf@tempb}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-ud operator +\def\tikzext@tikz@@ud@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc\tikz@lastx + \pgf@yb\tikz@lasty + \advance\tikz@lasty1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/ud distance}}% + \iftikz@shapeborder + \advance\pgf@y1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \else\ifx\pgf@temp\relax + \pgf@yc\pgf@yb + \fi + \fi + \ifdim\pgf@yc<\pgf@y + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc=\tikz@lasty + \else + \pgf@yc=\pgf@y + \fi + \fi + \advance\pgf@yc\tikzext@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \iftikzext@tikz@hvvh@fromcenter\else + \pgf@yb\pgf@yc + \fi + \fi + \ifdim\pgf@yb<\tikz@lasty\pgf@yb\tikz@lasty\fi + \advance\pgf@yb\tikzext@tikz@udlr@distance + \pgf@yc\pgf@yb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-du operator +\def\tikzext@tikz@@du@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc\tikz@lastx + \pgf@yb\tikz@lasty + \advance\tikz@lasty-1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/du distance}}% + \iftikz@shapeborder + \advance\pgf@y-1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc\pgf@yb + \else\ifx\pgf@temp\relax + \pgf@yc\pgf@yb + \fi + \fi + \ifdim\pgf@yc>\pgf@y + \iftikzext@tikz@hvvh@fromcenter + \pgf@yc=\tikz@lasty + \else + \pgf@yc=\pgf@y + \fi + \fi + \advance\pgf@yc-\tikzext@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \iftikzext@tikz@hvvh@fromcenter\else + \pgf@yb\pgf@yc + \fi + \fi + \ifdim\pgf@yb>\tikz@lasty\pgf@yb\tikz@lasty\fi + \advance\pgf@yb-\tikzext@tikz@udlr@distance + \pgf@yc\pgf@yb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\tikz@lastx}{\the\pgf@yc}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@vhvline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-lr operator +\def\tikzext@tikz@@lr@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb\tikz@lastx + \pgf@yc\tikz@lasty + \advance\tikz@lastx-1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/ortho}{/tikz/style/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/lr distance}}% + \iftikz@shapeborder + \advance\pgf@x-1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \else\ifx\pgf@temp\relax + \pgf@xc\pgf@xb + \fi + \fi + \ifdim\pgf@xc>\pgf@x + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc=\tikz@lastx + \else + \pgf@xc=\pgf@x + \fi + \fi + \advance\pgf@xc-\tikzext@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty + \ifx\pgf@temp\relax\else + \iftikzext@tikz@hvvh@fromcenter\else + \pgf@xb\pgf@xc + \fi + \fi + \ifdim\pgf@xb>\tikz@lastx\pgf@xb\tikz@lastx\fi + \advance\pgf@xb-\tikzext@tikz@udlr@distance + \pgf@xc\pgf@xb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% r-rl operator +\def\tikzext@tikz@@rl@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xb\tikz@lastx + \pgf@yc\tikz@lasty + \advance\tikz@lastx1pt% + \let\pgf@temp\tikz@moveto@waiting + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}\pgf@xc\pgf@yc + \tikz@make@last@position{#1}% + \begingroup + \pgfqkeys{/tikz/udlr}{/tikz/ortho/.expand once=\tikz@hvvh@currentoption}% + \pgfmathsetlength\tikzext@tikz@udlr@distance{\pgfkeysvalueof{/tikz/ortho/rl distance}}% + \iftikz@shapeborder% + \advance\pgf@x1pt% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@x}{\pgf@y}}}% + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc\pgf@xb + \else\ifx\pgf@temp\relax + \pgf@xc\pgf@xb + \fi + \fi + \ifdim\pgf@xc<\pgf@x + \iftikzext@tikz@hvvh@fromcenter + \pgf@xc=\tikz@lastx + \else + \pgf@xc=\pgf@x + \fi + \fi + \advance\pgf@xc\tikzext@tikz@udlr@distance + \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \else + \let\tikz@shapeborder@name\pgfutil@empty% + \ifx\pgf@temp\relax\else + \iftikzext@tikz@hvvh@fromcenter\else + \pgf@xb\pgf@xc + \fi + \fi + \ifdim\pgf@xb<\tikz@lastx\pgf@xb\tikz@lastx\fi + \advance\pgf@xb\tikzext@tikz@udlr@distance + \pgf@xc\pgf@xb + \edef\pgf@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi + \xdef\pgf@marshal{% + \noexpand\tikz@do@hvvh + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\tikz@lasty}}% + {\expandafter\noexpand\pgf@temp}% + {\noexpand\tikz@timer@hvhline}{\tikz@shapeborder@name}}% + \endgroup + \pgf@marshal}% + +%% a few nice to haves, use with to or edge operator +\tikzset{ + node as new start/.is if=tikzext@ortho@preflush, + node as new start, + ortho/install shortcuts/.style={ + *|/.style={only vertical second={#1}}, *|/.default=, + |*/.style={only vertical first={#1}}, |*/.default=, + *-/.style={only horizontal second={#1}}, *-/.default=, + -*/.style={only horizontal first={#1}}, -*/.default=, + |-/.style={to path={|-(\tikztotarget)\tikztonodes}}, + -|/.style={to path={-|(\tikztotarget)\tikztonodes}}, + -|-/.style=/tikz/horizontal vertical horizontal, + |-|/.style=/tikz/vertical horizontal vertical, + }, + horizontal vertical/.style={to path={-| (\tikztotarget) \tikztonodes}}, + vertical horizontal/.style={to path={|- (\tikztotarget) \tikztonodes}}, + horizontal vertical horizontal/.style={to path={-|- (\tikztotarget) \tikztonodes}}, + vertical horizontal vertical/.style={to path={|-| (\tikztotarget) \tikztonodes}}, + only vertical second/.style={to path={ + \pgfextra + \let\tikzext@ortho@anchor\pgfutil@empty + \let\tikzext@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \iftikz@shapeborder + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \ifdim\pgf@y>\tikz@lasty\relax + \edef\tikztostart{\tikztostart.north}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.south}\fi + \else + \edef\tikztostart{\tikztostart.south}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.north}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \let\tikzext@origtotarget\tikztotarget + \edef\tikztotarget{[xshift={#1}]\tikztotarget\tikzext@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={ + (perpendicular cs: horizontal line through={(\tikztostart)}, + vertical line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes + \pgfextra + \ifx\tikzext@origtotarget\pgfutil@empty\else + \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, + only vertical second/.default=, + only horizontal second/.style={to path={ + \pgfextra + \let\tikzext@ortho@anchor\pgfutil@empty + \let\tikzext@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \iftikz@shapeborder + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \ifdim\pgf@x>\tikz@lastx\relax + \edef\tikztostart{\tikztostart.east}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.west}\fi + \else + \edef\tikztostart{\tikztostart.west}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.east}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \let\tikzext@origtotarget\tikztotarget + \edef\tikztotarget{[yshift={#1}]\tikztotarget\tikzext@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={ + (perpendicular cs: vertical line through={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) -- (\tikztotarget)}] \tikztonodes + \pgfextra + \ifx\tikzext@origtotarget\pgfutil@empty\else + \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, + only horizontal second/.default=, + only vertical first/.style={to path={ + \pgfextra + \let\tikzext@ortho@anchor\pgfutil@empty + \let\tikzext@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \pgf@ya=\pgf@y + \iftikz@shapeborder + \let\tikzext@origtotarget\tikztotarget + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \ifdim\pgf@ya>\tikz@lasty\relax + \edef\tikztotarget{\tikztotarget.south}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.north}\fi + \else + \edef\tikztotarget{\tikztotarget.north}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.south}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \edef\tikztostart{[xshift={#1}]\tikztostart\tikzext@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={(\tikztostart)}] + -- (perpendicular cs: vertical line through/.expanded={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) + \tikztonodes + \pgfextra + \ifx\tikzext@origtotarget\pgfutil@empty\else + \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, + only vertical first/.default=, + only horizontal first/.style={to path={ + \pgfextra + \let\tikzext@ortho@anchor\pgfutil@empty + \let\tikzext@origtotarget\pgfutil@empty + \tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax + \pgf@xa=\pgf@x + \iftikz@shapeborder + \let\tikzext@origtotarget\tikztotarget + \tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax + \ifdim\pgf@xa>\tikz@lastx\relax + \edef\tikztotarget{\tikztotarget.west}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.east}\fi + \else + \edef\tikztotarget{\tikztotarget.east}% + \iftikz@shapeborder\def\tikzext@ortho@anchor{.west}\fi + \fi + \fi + \def\tikz@tempa{#1}% + \ifx\tikz@tempa\pgfutil@empty\else + \edef\tikztostart{[yshift={#1}]\tikztostart\tikzext@ortho@anchor}% + \fi + \endpgfextra + [insert path/.expanded={(\tikztostart)}] + -- (perpendicular cs: horizontal line through/.expanded={(\tikztostart)}, + vertical line through={(\tikztotarget)}) + \tikztonodes \pgfextra + \ifx\tikzext@origtotarget\pgfutil@empty\else + \iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi\endpgfextra}}, + only horizontal first/.default=, + only vertical first to center/.style={to path={ + \pgfextra + \let\tikzext@origtotarget\tikztotarget + \endpgfextra + (\tikztostart) -- (perpendicular cs: vertical line through={(\tikztostart)}, + horizontal line through={(\tikztotarget)}) + \tikztonodes \ifx\tikzext@origtotarget\pgfutil@empty\else\iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi}}, + only horizontal first to center/.style={to path={ + \pgfextra + \let\tikzext@origtotarget\tikztotarget + \endpgfextra + (\tikztostart) -- (perpendicular cs: horizontal line through={(\tikztostart)}, + vertical line through={(\tikztotarget)}) + \tikztonodes \ifx\tikzext@origtotarget\pgfutil@empty\else\iftikzext@ortho@preflush(\tikzext@origtotarget)\fi\fi}}% +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.timer.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.timer.code.tex new file mode 100644 index 0000000000..3a4d30e68f --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.paths.timer.code.tex @@ -0,0 +1,188 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\def\tikz@rectB#1{% originally from tikz.code.tex + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \let\tikz@timer\tikz@timer@rectangle% %% Timer: new timer + \tikz@@movetosave{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% + \iftikz@snaked + \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \fi + \pgfpathclose + \tikz@@movetosave{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \def\pgfstrokehook{}% + \let\tikz@tangent\relax + \tikz@scan@next@command +}% + +\def\tikz@@sine#1{% originally from tikz.code.tex + \let\tikz@tangent\tikz@tangent@lookup + \tikz@flush@moveto + \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@process{#1}% + \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: saver target position + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + \advance\tikz@lastx by\pgf@xc + \advance\tikz@lasty by\pgf@yc + \tikz@lastxsaved=\tikz@lastx + \tikz@lastysaved=\tikz@lasty + \tikz@updatecurrenttrue + \let\tikz@timer=\tikz@timer@sine% %% Timer: new timer + \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command +} + +\def\tikz@@cosine#1{% originally from tikz.code.tex + \let\tikz@tangent\tikz@tangent@lookup + \tikz@flush@moveto + \edef\tikz@timer@start{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@process{#1}% + \edef\tikz@timer@end{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% %% Timer: save target position + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + \advance\tikz@lastx by\pgf@xc + \advance\tikz@lasty by\pgf@yc + \tikz@lastxsaved=\tikz@lastx + \tikz@lastysaved=\tikz@lasty + \tikz@updatecurrenttrue + \let\tikz@timer=\tikz@timer@cosine% %% Timer: new timer + \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command +} + +\def\tikz@timer@rectangle{% + \pgfutil@tempdima\tikz@time pt + \ifdim\pgfutil@tempdima<.5pt\else % if we're at the return pos-ition we switch start and end + \advance\pgfutil@tempdima-.5pt + \let\pgf@tempa\tikz@timer@start + \let\tikz@timer@start\tikz@timer@end + \let\tikz@timer@end\pgf@tempa + \fi + \multiply\pgfutil@tempdima2 + \edef\tikz@time{\strip@pt\pgfutil@tempdima}% + \tikz@timer@hvline}% + +\def\tikz@parabola@semifinal#1{% + \tikz@flush@moveto + % Save original start: + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save start position + \pgf@xb=\tikz@lastx + \pgf@yb=\tikz@lasty + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save target position + \pgf@xc=\tikz@lastx + \pgf@yc=\tikz@lasty + \begingroup% now calculate bend: + \let\tikz@after@path\pgfutil@empty + \expandafter\tikzset\expandafter{\tikz@parabola@option}% + \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx + \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty + \advance\tikz@lastxsaved by\pgf@xb + \advance\tikz@lastysaved by\pgf@yb + \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb + \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb + \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% + \edef\tikz@timer@middle{{\the\tikz@lastx}{\the\tikz@lasty}}% %% Timer: save bend postion + % Calculate delta from bend + \advance\pgf@xc by-\tikz@lastx + \advance\pgf@yc by-\tikz@lasty + % Ok, now calculate delta to bend + \advance\tikz@lastx by-\pgf@xb + \advance\tikz@lasty by-\pgf@yb + \edef\tikz@marshall{% + \noexpand\let\noexpand\tikz@timer\noexpand\tikz@timer@parabola + \noexpand\edef\noexpand\tikz@timer@middle{\noexpand\pgfqpoint\tikz@timer@middle}% + \noexpand\pgfpathparabola{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \expandafter\endgroup% + \tikz@marshall + \expandafter\tikz@scan@next@command\tikz@after@path% +}% + +\def\tikz@timer@parabola{% following calculations, see \def of \pgfpathparabola in pgfcorepathconstruct.code.tex (l. 1261) + \ifdim\tikz@time pt<.5pt\relax % first part + \pgf@process{\tikz@timer@middle}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xc-\pgf@x\pgf@xc.1125\pgf@xc + \advance\pgf@xc\pgf@x % = start_x + .1125 (middle_x - start_x) + \advance\pgf@yc-\pgf@y\pgf@yc.225\pgf@yc + \advance\pgf@yc\pgf@y % = start_y + .225 (middle_y - start_y) + \advance\pgf@xb\pgf@x\pgf@xb.5\pgf@xb % = .5 (middle_x + start_x) = start_x + .5 (middle_x - start_x) + \pgf@xa=\tikz@time pt% + \pgf@xa=2\pgf@xa % = 2 * \tikz@time + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@middle}}% + \else % second part + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x + \pgf@xb\pgf@x + \pgf@yb\pgf@y + \pgf@process{\tikz@timer@middle}% + \advance\pgf@xc\pgf@x\pgf@xc.5\pgf@xc % = .5 (end_x + middle_x) = middle_x + .5 (end_x - middle_x) + \advance\pgf@xb-\pgf@x\pgf@xb.8875\pgf@xb + \advance\pgf@xb\pgf@x % = middle_x + .8875 (end_x - middle_x) + \advance\pgf@yb-\pgf@y\pgf@yb.775\pgf@yb + \advance\pgf@yb\pgf@y % = middle_y + .775 (end_y - middle_y) + \pgf@xa=\tikz@time pt% + \advance\pgf@xa-.5pt% + \pgf@xa=2\pgf@xa % = 2 (\tikz@zime - .5) + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\strip@pt\pgf@xa}{\noexpand\tikz@timer@middle}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \fi + \tikz@marshall +} + +\def\tikz@timer@sine{% following calculations, see \def of \pgfpathsine in pgfcorepathconstruct.code.tex (l. 1315) + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xc-\pgf@x\pgf@xc.3260\pgf@xc + \advance\pgf@xc\pgf@x % = start_x + .3260 (end_x - start_x) + \advance\pgf@yc-\pgf@y\pgf@yc.5120\pgf@yc + \advance\pgf@yc\pgf@y % = start_y + .5120 (end_y - start_y) + \advance\pgf@xb-\pgf@x\pgf@xb.6380\pgf@xb % = start_x + .6380 (end_x - start_x) + \advance\pgf@xb\pgf@x + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \tikz@marshall +} +\def\tikz@timer@cosine{% following calculations, see \def of \pgfpathcosine in pgfcorepathconstruct.code.tex (l. 1345) + \pgf@process{\tikz@timer@end}% + \pgf@xc\pgf@x\pgf@yc\pgf@y + \pgf@xb\pgf@x\pgf@yb\pgf@y + \pgf@process{\tikz@timer@start}% + \advance\pgf@xb-\pgf@x\pgf@xb.6740\pgf@xb + \advance\pgf@xb\pgf@x % = start_x + .6740 (end_x - start_x) + \advance\pgf@yb-\pgf@y\pgf@yb.4880\pgf@yb + \advance\pgf@yb\pgf@y % = start_y + .4880 (end_y - start_y) + \advance\pgf@xc-\pgf@x\pgf@xc.3620\pgf@xc % = start_x + .3620 (end_x - start_x) + \advance\pgf@xc\pgf@x + \edef\tikz@marshall{\noexpand\pgftransformcurveattime{\tikz@time}{\noexpand\tikz@timer@start}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@y}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\tikz@timer@end}}% + \tikz@marshall +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.patterns.images.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.patterns.images.code.tex new file mode 100644 index 0000000000..aa732ab835 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.patterns.images.code.tex @@ -0,0 +1,60 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +% This is the TikZ library patterns.images +% Load with \usetikzlibrary{patterns.images} +% +% Macro: +% - \pgfSetupImageAsPattern[]{}{} +% +% Keys are: +% - use image as pattern= +% - image as pattern= + +\def\pgfsetupimageaspattern{\pgfutil@ifnextchar[\tikzext@pgfsetupimageaspattern{\tikzext@pgfsetupimageaspattern[]}} +\def\tikzext@pgfsetupimageaspattern[#1]#2#3{% #1 = options + % #2 = image name + % #3 = file name + \pgfdeclareimage[#1]{tikzext@pgf@iap@#2}{#3}% + \sbox\pgfutil@tempboxa{\pgfuseimage{tikzext@pgf@iap@#2}}% + \expandafter\edef\csname tikzext@pgf@iap@#2@\endcsname{{\the\wd\pgfutil@tempboxa}{\the\ht\pgfutil@tempboxa}}% +} +\tikzset{ + image as pattern/name/.initial=, + image as pattern/option/.style=, + image as pattern/options/.style={/tikz/image as pattern/option/.append style={#1}}, + image as pattern/.default=, + image as pattern/.code={ + \pgfqkeys{/tikz/image as pattern}{#1}% + \pgfkeysgetvalue{/tikz/image as pattern/name}\tikz@temp + \pgfutil@ifxempty\tikz@temp{% + \tikzerror{You need to specify a name for the ``image-pattern'' to be used.}% + }{% + \edef\tikz@tempa{\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname tikzext@pgf@iap@\tikz@temp @\endcsname}% + \edef\tikz@tempb{\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname tikzext@pgf@iap@\tikz@temp @\endcsname}% + \pgfkeysalso{/tikz/path picture={% + \pgf@process{\pgfpointanchor{path picture bounding box}{north east}}% + \pgf@xa\pgf@x\pgf@ya\pgf@y + \pgf@process{\pgfpointanchor{path picture bounding box}{south west}}% + \pgf@xb\pgf@x\pgf@yb\pgf@y\pgf@yc\pgf@yb + \pgfutil@loop + {% + \pgfutil@loop + \expandafter\pgftext\expandafter[/tikz/image as pattern/option,at=\pgfqpoint{\pgf@xb}{\pgf@yb}]{\pgfuseimage{tikzext@pgf@iap@\tikz@temp}}% + \ifdim\pgf@yb<\pgf@ya + \advance\pgf@yb\tikz@tempb + \pgfutil@repeat + }% + \ifdim\pgf@xb<\pgf@xa + \advance\pgf@xb\tikz@tempa + \pgf@yb\pgf@yc + \pgfutil@repeat + }}% + } + } +} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.positioning-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.positioning-plus.code.tex new file mode 100644 index 0000000000..e430f42a7e --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.positioning-plus.code.tex @@ -0,0 +1,262 @@ +% This is the TikZ library positioning-plus +% Load with \usetikzlibrary{positioning-plus} +% +% This small library extends TikZ options like 'above', 'left' or 'below right' +% so that they can be used with an optional prefixed factor seperated by ':' (colon) +% +% The option 'left=.5:of somenode' will place +% a new node .5cm (default 'node distance' is '1cm and 1cm') left to (somenode). +% The option 'above right=.2 and .7:of someothernode' will place +% a new node .2cm above and .7cm right of (someothernode). +% +% Additional the options 'xshift*' and 'yshift*' add an additional shift +% as a factor of 'node distance' +% Inspired by http://tex.stackexchange.com/a/117610/16595 + +\usetikzlibrary{positioning} +\usetikzlibrary{fit} + +\pgfdeclaregenericanchor{corner south east}{% + \pgf@sh@reanchor{#1}{south}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{east}}% + \pgf@y\pgf@ya +} +\pgfdeclaregenericanchor{corner north east}{% + \pgf@sh@reanchor{#1}{north}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{east}}% + \pgf@y\pgf@ya +} +\pgfdeclaregenericanchor{corner south west}{% + \pgf@sh@reanchor{#1}{south}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{west}}% + \pgf@y\pgf@ya +} +\pgfdeclaregenericanchor{corner north west}{% + \pgf@sh@reanchor{#1}{north}% + \pgf@ya\pgf@y + \pgf@process{\pgf@sh@reanchor{#1}{west}}% + \pgf@y\pgf@ya +} + +\tikzset{corner above left/.code=\tikz@lib@place@handle@{#1}{corner south east}{-1}{1}{corner north west}{0.707106781}} +\tikzset{corner above right/.code=\tikz@lib@place@handle@{#1}{corner south west}{1}{1}{corner north east}{0.707106781}} +\tikzset{corner below left/.code=\tikz@lib@place@handle@{#1}{corner north east}{-1}{-1}{corner south west}{0.707106781}} +\tikzset{corner below right/.code=\tikz@lib@place@handle@{#1}{corner north west}{1}{-1}{corner south east}{0.707106781}} + +\tikzset{corner north left/.code =\tikz@lib@place@handle@{#1}{corner north east}{-1}{0}{corner north west}{1}} +\tikzset{corner north right/.code=\tikz@lib@place@handle@{#1}{corner north west}{1}{0}{corner north east}{1}} +\tikzset{corner south left/.code =\tikz@lib@place@handle@{#1}{corner south east}{-1}{0}{corner south west}{1}} +\tikzset{corner south right/.code=\tikz@lib@place@handle@{#1}{corner south west}{1}{0}{corner south east}{1}} + +\tikzset{corner west above/.code =\tikz@lib@place@handle@{#1}{corner south west}{0}{1}{corner north west}{1}} +\tikzset{corner west below/.code=\tikz@lib@place@handle@{#1}{corner north west}{0}{-1}{corner south west}{1}} +\tikzset{corner east above/.code =\tikz@lib@place@handle@{#1}{corner south east}{0}{1}{corner north east}{1}} +\tikzset{corner east below/.code=\tikz@lib@place@handle@{#1}{corner north east}{0}{-1}{corner south east}{1}} + +\tikzset{north left/.code =\tikz@lib@place@handle@{#1}{north east}{-1}{0}{north west}{1}} +\tikzset{north right/.code=\tikz@lib@place@handle@{#1}{north west}{1}{0}{north east}{1}} +\tikzset{south left/.code =\tikz@lib@place@handle@{#1}{south east}{-1}{0}{south west}{1}} +\tikzset{south right/.code=\tikz@lib@place@handle@{#1}{south west}{1}{0}{south east}{1}} + +\tikzset{west above/.code =\tikz@lib@place@handle@{#1}{south west}{0}{1}{north west}{1}} +\tikzset{west below/.code=\tikz@lib@place@handle@{#1}{north west}{0}{-1}{south west}{1}} +\tikzset{east above/.code =\tikz@lib@place@handle@{#1}{south east}{0}{1}{north east}{1}} +\tikzset{east below/.code=\tikz@lib@place@handle@{#1}{north east}{0}{-1}{south east}{1}} + +\newif\iftikzext@tikz@lib@place@postransform +\tikzset{node distance transformation/.is if=tikzext@tikz@lib@place@postransform} +\def\tikz@lib@place@handle@@#1#2#3#4{% + \pgfutil@in@{of }{#1}% + \ifpgfutil@in@ + \tikz@lib@place@of#1\tikz@stop{#4}% + \else + \edef\tikz@lib@place@nums{#1}% + \fi + \ifx\tikz@lib@place@nums\pgfutil@empty + % Ok, nothing to do, we have set the anchor and we are happy... + \else + \expandafter\tikz@lib@place@parse@nums\expandafter{\tikz@lib@place@nums}% + \pgf@x=#2\pgf@x + \pgf@y=#3\pgf@y + \iftikzext@tikz@lib@place@postransform + \pgf@pos@transform{\pgf@x}{\pgf@y}% change from original + \fi + \edef\tikz@lib@pos@call{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% + \fi +} + +\def\tikz@lib@place@handle@#1#2#3#4#5#6{% + \pgfutil@in@{:}{#1}% + \ifpgfutil@in@ + \tikzext@lib@place@handle@#1\tikz@stop + \ifx\pgf@temp\pgfutil@empty + \let\pgf@temp\tikz@node@distance + \fi + \pgfmathsetmacro\pgf@tempa{(\pgf@tempa)*#4}% + \pgfmathsetmacro\pgf@tempb{(\pgf@tempb)*#3}% + \edef\pgf@marshal{\noexpand\tikz@lib@place@handle@{\pgf@temp}{#2}{\pgf@tempb}{\pgf@tempa}{#5}{#6}}% + \pgf@marshal + \else + \def\tikz@anchor{#2}% + \let\tikz@do@auto@anchor=\relax + \edef\tikz@temp{#1}% + \def\tikz@lib@place@single@factor{#6}% + \expandafter\tikz@lib@place@handle@@\expandafter{\tikz@temp}{#3}{#4}{#5}% + \fi +} +\def\tikzext@lib@place@handle@#1:#2\tikz@stop{% + \pgfutil@in@{and}{#1}% + \ifpgfutil@in@ + \tikzext@lib@place@handle@@#1\tikz@stop + \else + \tikzext@lib@place@handle@@#1and#1\tikz@stop + \fi + \def\pgf@temp{#2}% +} +\def\tikzext@lib@place@handle@@#1and#2\tikz@stop{% + \def\pgf@tempa{#1}% + \def\pgf@tempb{#2}% +} +\def\tikzext@xyshift@starred#1#2#3{% + \edef\tikz@marshal{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% + \tikz@marshal + \ifpgfutil@in@ + \expandafter\tikzext@lib@place@handle@@\tikz@node@distance\tikz@stop + \else + \let#3\tikz@node@distance + \fi + \pgfmathparse{(#1)*#3}% + \ifpgfmathunitsdeclared + \if#2x% + \pgftransformshift{\pgfqpoint{\pgfmathresult pt}{0pt}}% + \else + \pgftransformshift{\pgfqpoint{0pt}{\pgfmathresult pt}}% + \fi + \else + \ifx#2x% + \pgf@process{\pgfqpointxy{\pgfmathresult}{0}}% + \else + \pgf@process{\pgfqpointxy{0}{\pgfmathresult}}% + \fi + \pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}% + \fi} +\tikzset{ + xshift*/.code=\tikzext@xyshift@starred{#1}x\pgf@tempb, + yshift*/.code=\tikzext@xyshift@starred{#1}y\pgf@tempa +} + +\def\pgfutil@firstofmany#1#2\pgf@stop{#1} +\def\pgfutil@secondofmany#1#2\pgf@stop{#2} +\def\tikz@lib@place@of@#1#2#3{% + \def\pgf@tempa{fit bounding box}% + \edef\pgf@temp{\expandafter\pgfutil@firstofmany#2\pgf@stop} + \if\pgf@temp(% + \tikz@lib@place@fit@scan{#2}{0}% + \else\if\pgf@temp|% + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}% + \else\ifx\pgf@temp\tikz@activebar + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}% + \else\if\pgf@temp-% + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{2}% + \else\if\pgf@temp+% + \expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{3}% + \else + \def\pgf@tempa{#2}% + \fi + \fi + \fi + \fi + \fi + \expandafter\tikz@scan@one@point\expandafter\tikz@lib@place@remember\expandafter(\pgf@tempa)% + \iftikz@shapeborder% + % Ok, this is relative to a border. + \iftikz@lib@ignore@size% + \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{center}}% + \def\tikz@anchor{center}% + \else% + \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{#3}}% + \fi% + \fi% + \edef\tikz@lib@place@nums{#1}% +} +\def\tikz@lib@place@fit@scan#1#2{% + \pgf@xb=-16000pt\relax% + \pgf@xa=16000pt\relax% + \pgf@yb=-16000pt\relax% + \pgf@ya=16000pt\relax% + \if\pgfutil@firstofmany#1\pgf@stop(% + \tikz@lib@fit@scan#1\pgf@stop% + \else + \tikz@lib@fit@scan(#1)\pgf@stop + \fi + \ifdim\pgf@xa>\pgf@xa + % shouldn't happen + \else + \expandafter\def\csname pgf@sh@ns@fit bounding box\endcsname{rectangle}% + \expandafter\edef\csname pgf@sh@np@fit bounding box\endcsname{% + \def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + }% + \expandafter\def\csname pgf@sh@nt@fit bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% + \expandafter\def\csname pgf@sh@pi@fit bounding box\expandafter\endcsname\expandafter{\pgfpictureid}% + \ifcase#2\relax + \or % 1 = vertical + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})}}}% + \pgf@marshal + \or % 2 = horizontal + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \edef\pgf@marshal{\noexpand\pgfset{minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}% + \pgf@marshal + \or % 3 = both directions + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \edef\pgf@marshal{\noexpand\pgfset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})},minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}% + \pgf@marshal + \fi + \fi +} +\tikzset{ + fit bounding box/.code={\tikz@lib@place@fit@scan{#1}{0}}, + span vertical/.code={\tikz@lib@place@fit@scan{#1}{1}}, + span horizontal/.code={\tikz@lib@place@fit@scan{#1}{2}}, + span/.code={\tikz@lib@place@fit@scan{#1}{3}}} + +\pgfmathdeclarefunction{x_node_dist}{0}{% + \begingroup + \edef\pgfmath@temp{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% + \pgfmath@temp\ifpgfutil@in@ + \expandafter\tikzext@lib@place@handle@@\tikz@node@distance\tikz@stop + \else + \let\pgf@tempb\tikz@node@distance + \fi + \pgfmathparse{\pgf@tempb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\pgfmathdeclarefunction{y_node_dist}{0}{% + \begingroup + \edef\pgfmath@temp{\noexpand\pgfutil@in@{and}{\tikz@node@distance}}% + \pgfmath@temp\ifpgfutil@in@ + \expandafter\tikzext@lib@place@handle@@\tikz@node@distance\tikz@stop + \else + \let\pgf@tempa\tikz@node@distance + \fi + \pgfmathparse{\pgf@tempa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +%\tikzdeclarecoordinatesystem{node distance}{% +% \tikz@cs@nd#1\tikz@stop} +%\def\tikz@cs@nd#1,#2\tikz@stop{% +% \def\tikzext@xyshift@starred@action##1{\pgftransformshift{##1}}% +% \tikzext@xyshift@starred{#1}x\pgf@tempb +% \tikzext@xyshift@starred{#2}y\pgf@tempa} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.scalepicture.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.scalepicture.code.tex new file mode 100644 index 0000000000..5ae055bb5d --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.scalepicture.code.tex @@ -0,0 +1,194 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\def\tikzext@scalepicture@savepicturesize{% + \pgf@process{% + \pgfpointdiff + {\pgfpointanchor{current bounding box}{south west}} + {\pgfpointanchor{current bounding box}{north east}}}% + \immediate\write\pgfutil@auxout{% + \noexpand\expandafter\gdef + \noexpand\csname tikzext@scalepicture@\pgfpictureid\endcsname{{\the\pgf@x}{\the\pgf@y}}% + }% + \let\tikzext@scalepicture@savepicturesize\relax +} + +\def\tikzext@scalepicture@width{% + \expandafter\expandafter\expandafter\pgfutil@firstoftwo + \csname tikzext@scalepicture@\pgfpictureid\endcsname +} +\def\tikzext@scalepicture@height{% + \expandafter\expandafter\expandafter\pgfutil@secondoftwo + \csname tikzext@scalepicture@\pgfpictureid\endcsname +} + +\def\tikzextpicturewidth{% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{0pt}{\tikzext@scalepicture@width}} +\def\tikzextpictureheight{% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{0pt}{\tikzext@scalepicture@height}} +\tikzset{ + save picture size/.style={execute at end picture=\tikzext@scalepicture@savepicturesize}, + save picture size/.value forbidden, + %%% keep aspect ratio + %% width and height + minimum picture size/.code 2 args={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \pgfmathsetlength\pgf@ya{#2}% + \def\tikz@tempa{0}% + \def\tikz@temp{0}% + \ifdim\tikzext@scalepicture@width<\pgf@xa + \pgfmathsetmacro\tikz@tempa{\pgf@xa/\tikzext@scalepicture@width}% + \fi + \ifdim\tikzext@scalepicture@height<\pgf@ya + \pgfmathsetmacro\tikz@temp{\pgf@ya/\tikzext@scalepicture@height}% + \fi + \ifdim\tikz@tempa pt>\tikz@temp pt + \let\tikz@temp\tikz@tempa + \fi + \ifdim\tikz@temp pt>0pt + \tikzset{scale/.expand once=\tikz@temp}% + \fi + }% + }, + maximum picture size/.code 2 args={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \pgfmathsetlength\pgf@ya{#2}% + \def\tikz@tempa{0}% + \def\tikz@temp{0}% + \ifdim\tikzext@scalepicture@width>\pgf@xa + \pgfmathsetmacro\tikz@tempa{\pgf@xa/\tikzext@scalepicture@width}% + \fi + \ifdim\tikzext@scalepicture@height>\pgf@ya + \pgfmathsetmacro\tikz@temp{\pgf@ya/\tikzext@scalepicture@height}% + \fi + \ifdim\tikz@tempa pt<\tikz@temp pt + \let\tikz@temp\tikz@tempa + \fi + \ifdim\tikz@temp pt>0pt + \tikzset{scale/.expand once=\tikz@temp}% + \fi + }% + }, + %%% keep aspect ratio + %% width + picture width/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{scale={(#1)/\tikzext@scalepicture@width}}% + }% + }, + minimum picture width/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width<\pgf@xa + \tikzset{scale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + maximum picture width/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width>\pgf@xa + \tikzset{scale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + %%% xscale only + %% width + picture width*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{xscale={(#1)/\tikzext@scalepicture@width}}% + }% + }, + minimum picture width*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width<\pgf@xa + \tikzset{xscale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + maximum picture width*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width>\pgf@xa + \tikzset{xscale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + %%% keep aspect ratio + %% height + picture height/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{yscale={(#1)/\tikzext@scalepicture@height}}% + }% + }, + minimum picture height/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{scale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + maximum picture height/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{scale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + %%% yscale only + %% height + picture height*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{yscale={(#1)/\tikzext@scalepicture@height}}% + }% + }, + minimum picture height*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{yscale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + maximum picture height*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{yscale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + %%% xscale or yscale + picture size*/.code 2 args={% #1 = width, #2 = height + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{ + xscale={(#1)/\tikzext@scalepicture@width}, + yscale={(#2)/\tikzext@scalepicture@height}}% + }% + }, +} +\endinput \ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.topaths.arcthrough.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.topaths.arcthrough.code.tex new file mode 100644 index 0000000000..d90a2edc78 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.topaths.arcthrough.code.tex @@ -0,0 +1,50 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\pgfqkeys{/tikz/arc through}{ + .unknown/.code=\pgfkeyssetevalue{/tikz/arc through/through}{\pgfkeyscurrentname}, + through/.initial={(0,0)}, + center suffix/.initial=, + clockwise/.code=% + \def\tikz@arcthrough@clockwise{% + \pgfmathsubtract@{\pgfkeysvalueof{/tikz/end angle}}{360}% + \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}}, + counter clockwise/.code=\let\tikz@arcthrough@clockwise\relax, + clockwise/.value forbidden, counter clockwise/.value forbidden, counter clockwise} +\tikzset{ + arc through/.code={% + \tikzset{every arc through/.try}% + \pgfqkeys{/tikz/arc through}{#1}% + \pgfkeysgetvalue{/tikz/arc through/through}\tikz@temp + \pgfextract@process\pgf@tostart{\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax}% + \expandafter\pgfextract@process\expandafter\pgf@tothrough\expandafter + {\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\tikz@temp\relax}% + \pgfextract@process\pgf@totarget{\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax}% + \pgfextract@process\pgf@topointMidA{\pgfpointlineattime{.5}{\pgf@tostart}{\pgf@tothrough}}% + \pgfextract@process\pgf@topointMidB{\pgfpointlineattime{.5}{\pgf@totarget}{\pgf@tothrough}}% + \pgfextract@process\pgf@tocenter{% + \pgfpointintersectionoflines + {\pgf@topointMidA}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidA}{90}}% + {\pgf@topointMidB}{\pgfmathrotatepointaround{\pgf@tothrough}{\pgf@topointMidB}{90}}}% + \pgfcoordinate{arc through center\pgfkeysvalueof{/tikz/arc through/center suffix}}{\pgf@tocenter}% + \pgfpointdiff{\pgf@tocenter}{\pgf@tostart}% + \pgfmathveclen@{\pgfmath@tonumber\pgf@x}{\pgfmath@tonumber\pgf@y}% + \pgfkeyssetevalue{/tikz/x radius}{+\pgfmathresult pt}% + \pgfkeyssetevalue{/tikz/y radius}{+\pgfmathresult pt}% + \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@totarget}% + \pgfkeyssetevalue{/tikz/end angle}{+\pgfmathresult}% + \pgfmathanglebetweenpoints{\pgf@tocenter}{\pgf@tostart}% + \ifdim\pgfmathresult pt>\pgfkeysvalueof{/tikz/end angle}pt\relax + \pgfmathsubtract@{\pgfmathresult}{360}% + \fi + \pgfkeyssetevalue{/tikz/start angle}{+\pgfmathresult}% + \tikz@arcthrough@clockwise + \pgfkeyslet{/tikz/delta angle}\pgfutil@empty + \def\tikz@to@path{arc[]\tikztonodes}% + }% +} diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.transformations.mirror.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.transformations.mirror.code.tex new file mode 100644 index 0000000000..026b39ab2f --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.transformations.mirror.code.tex @@ -0,0 +1,130 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\usepgflibrary{ext.transformations.mirror} +\tikzset{ + mirror/.code={% + \pgfutil@in@{--}{#1}% + \ifpgfutil@in@ + \tikzext@trans@mirror#1\tikz@stop + \else + \tikz@addtransform{\tikz@scan@one@point\pgfqtransformmirror#1\relax}% + \fi}, + ymirror/.code={\pgfutil@ifnextchar(\tikzext@trans@ymirror@coordinate\tikzext@trans@ymirror@simple#1\tikz@stop}, + xmirror/.code={\pgfutil@ifnextchar(\tikzext@trans@xmirror@coordinate\tikzext@trans@xmirror@simple#1\tikz@stop}, + mirror x/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformmirror + {\expandafter\noexpand\tikz@temp} + {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} + {\noexpand\pgfqpointxy{0}{1}}}}}% + \tikz@marshal + }, + mirror y/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformmirror + {\expandafter\noexpand\tikz@temp} + {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} + {\noexpand\pgfqpointxy{1}{0}}}}}% + \tikz@marshal + }, + mirror/.value required, + ymirror/.default=+0pt, + xmirror/.default=+0pt, + mirror x/.default={(0,0)}, + mirror y/.default={(0,0)}% +} +\def\tikzext@trans@mirror#1--#2\tikz@stop{% + \tikz@addtransform{% + \pgftransformmirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} + {\tikz@scan@one@point\pgfutil@firstofone#2\relax}}} +\def\tikzext@trans@xmirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformxmirror{#1}}} +\def\tikzext@trans@ymirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformymirror{#1}}} +\def\tikzext@trans@xmirror@coordinate#1\tikz@stop{% + \tikz@scan@one@point\pgfutil@firstofone#1\relax + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformxmirror{+\the\pgf@x}% + }% + }% + \tikz@marshal +} +\def\tikzext@trans@ymirror@coordinate#1\tikz@stop{% + \tikz@scan@one@point\pgfutil@firstofone#1\relax + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformymirror{+\the\pgf@y}% + }% + }% + \tikz@marshal +} + +\tikzset{ + Mirror/.code={% + \pgfutil@in@{--}{#1}% + \ifpgfutil@in@ + \tikzext@trans@Mirror#1\tikz@stop + \else + \tikz@addtransform{\tikz@scan@one@point\pgfqtransformMirror#1\relax}% + \fi}, + yMirror/.code={\pgfutil@ifnextchar(\tikzext@trans@yMirror@coordinate\tikzext@trans@yMirror@simple#1\tikz@stop}, + xMirror/.code={\pgfutil@ifnextchar(\tikzext@trans@xMirror@coordinate\tikzext@trans@xMirror@simple#1\tikz@stop}, + Mirror x/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformMirror + {\expandafter\noexpand\tikz@temp} + {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} + {\noexpand\pgfqpointxy{0}{1}}}}}% + \tikz@marshal + }, + Mirror y/.code={% + \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}% + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformMirror + {\expandafter\noexpand\tikz@temp} + {\noexpand\pgfpointadd{\expandafter\noexpand\tikz@temp} + {\noexpand\pgfqpointxy{1}{0}}}}}% + \tikz@marshal + }, + Mirror/.value required, + yMirror/.default=+0pt, + xMirror/.default=+0pt, + Mirror x/.default={(0,0)}, + Mirror y/.default={(0,0)}% +} +\def\tikzext@trans@Mirror#1--#2\tikz@stop{% + \tikz@addtransform{% + \pgftransformMirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax} + {\tikz@scan@one@point\pgfutil@firstofone#2\relax}}} +\def\tikzext@trans@xMirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformxMirror{#1}}} +\def\tikzext@trans@yMirror@simple#1\tikz@stop{\tikz@addtransform{\pgftransformyMirror{#1}}} +\def\tikzext@trans@xMirror@coordinate#1\tikz@stop{% + \tikz@scan@one@point\pgfutil@firstofone#1\relax + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformxMirror{+\the\pgf@x}% + }% + }% + \tikz@marshal +} +\def\tikzext@trans@yMirror@coordinate#1\tikz@stop{% + \tikz@scan@one@point\pgfutil@firstofone#1\relax + \edef\tikz@marshal{% + \noexpand\tikz@addtransform{% + \noexpand\pgftransformyMirror{+\the\pgf@y}% + }% + }% + \tikz@marshal +} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/latex/pgfcalendar-ext.sty b/graphics/pgf/contrib/tikz-ext/tex/latex/pgfcalendar-ext.sty new file mode 100644 index 0000000000..a0f5ef3bc0 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/latex/pgfcalendar-ext.sty @@ -0,0 +1,11 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\RequirePackage{pgfcalendar} +\input{pgfcalendar-ext.code.tex} +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/latex/tikz-ext/pgfcalendar-ext.sty b/graphics/pgf/contrib/tikz-ext/tex/latex/tikz-ext/pgfcalendar-ext.sty deleted file mode 100644 index a0f5ef3bc0..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/latex/tikz-ext/pgfcalendar-ext.sty +++ /dev/null @@ -1,11 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\RequirePackage{pgfcalendar} -\input{pgfcalendar-ext.code.tex} -\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/plain/pgfcalendar-ext.tex b/graphics/pgf/contrib/tikz-ext/tex/plain/pgfcalendar-ext.tex new file mode 100644 index 0000000000..11507d5a7a --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/plain/pgfcalendar-ext.tex @@ -0,0 +1,13 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\input pgfcalendar.tex +\catcode`\@=11 +\input pgfcalendar-ext.code.tex +\catcode`\@=\pgfcalendaratcode +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/tex/plain/tikz-ext/pgfcalendar-ext.tex b/graphics/pgf/contrib/tikz-ext/tex/plain/tikz-ext/pgfcalendar-ext.tex deleted file mode 100644 index 30c44187a4..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/plain/tikz-ext/pgfcalendar-ext.tex +++ /dev/null @@ -1,13 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\input pgfcalendar.text -\catcode`\@=11 -\input pgfcalendar-ext.code.tex -\catcode`\@=\pgfcalendaratcode -\endinput -- cgit v1.2.3