├── .gitignore
├── .gitmodules
├── .travis.yml
├── CMakeLists.txt
├── LICENSE
├── README.md
├── docs
├── css
│ ├── auto-complete.css
│ ├── featherlight.min.css
│ ├── font-awesome.min.css
│ ├── hugo-theme.css
│ ├── hybrid.css
│ ├── nucleus.css
│ ├── perfect-scrollbar.min.css
│ ├── theme-blue.css
│ ├── theme-green.css
│ ├── theme-red.css
│ └── theme.css
├── en
│ ├── 404.html
│ ├── categories
│ │ ├── index.html
│ │ └── index.xml
│ ├── index.html
│ ├── index.xml
│ ├── sitemap.xml
│ └── tags
│ │ ├── index.html
│ │ └── index.xml
├── fonts
│ ├── FontAwesome.otf
│ ├── Inconsolata.eot
│ ├── Inconsolata.svg
│ ├── Inconsolata.ttf
│ ├── Inconsolata.woff
│ ├── Novecentosanswide-Normal-webfont.eot
│ ├── Novecentosanswide-Normal-webfont.svg
│ ├── Novecentosanswide-Normal-webfont.ttf
│ ├── Novecentosanswide-Normal-webfont.woff
│ ├── Novecentosanswide-Normal-webfont.woff2
│ ├── Novecentosanswide-UltraLight-webfont.eot
│ ├── Novecentosanswide-UltraLight-webfont.svg
│ ├── Novecentosanswide-UltraLight-webfont.ttf
│ ├── Novecentosanswide-UltraLight-webfont.woff
│ ├── Novecentosanswide-UltraLight-webfont.woff2
│ ├── Work_Sans_200.eot
│ ├── Work_Sans_200.svg
│ ├── Work_Sans_200.ttf
│ ├── Work_Sans_200.woff
│ ├── Work_Sans_200.woff2
│ ├── Work_Sans_300.eot
│ ├── Work_Sans_300.svg
│ ├── Work_Sans_300.ttf
│ ├── Work_Sans_300.woff
│ ├── Work_Sans_300.woff2
│ ├── Work_Sans_500.eot
│ ├── Work_Sans_500.svg
│ ├── Work_Sans_500.ttf
│ ├── Work_Sans_500.woff
│ ├── Work_Sans_500.woff2
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.svg
│ ├── fontawesome-webfont.ttf
│ ├── fontawesome-webfont.woff
│ └── fontawesome-webfont.woff2
├── google4e66d2ec1da84183.html
├── images
│ ├── clippy.svg
│ ├── favicon.png
│ └── gopher-404.jpg
├── index.html
├── ja
│ ├── 404.html
│ ├── categories
│ │ ├── index.html
│ │ └── index.xml
│ ├── index.html
│ ├── index.xml
│ ├── pitajs
│ │ ├── index.html
│ │ └── index.xml
│ ├── reference
│ │ ├── constraint
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── function
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── index.html
│ │ ├── index.xml
│ │ └── record
│ │ │ ├── index.html
│ │ │ └── index.xml
│ ├── sitemap.xml
│ ├── start
│ │ ├── index.html
│ │ └── index.xml
│ ├── syntax
│ │ ├── advanced
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── basic
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── entry
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── index.html
│ │ └── index.xml
│ ├── tags
│ │ ├── index.html
│ │ └── index.xml
│ └── tutorial
│ │ ├── index.html
│ │ ├── index.xml
│ │ └── recycle
│ │ ├── index.html
│ │ └── index.xml
├── js
│ ├── auto-complete.js
│ ├── clipboard.min.js
│ ├── featherlight.min.js
│ ├── highlight.pack.js
│ ├── html5shiv-printshiv.min.js
│ ├── hugo-learn.js
│ ├── jquery-2.x.min.js
│ ├── jquery.sticky.js
│ ├── learn.js
│ ├── lunr.min.js
│ ├── modernizr.custom.71422.js
│ ├── perfect-scrollbar.jquery.min.js
│ ├── perfect-scrollbar.min.js
│ ├── pita
│ │ ├── pita.js
│ │ └── pita.wasm
│ └── search.js
├── mermaid
│ ├── mermaid.css
│ ├── mermaid.dark.css
│ ├── mermaid.forest.css
│ └── mermaid.js
├── pita_doc
│ ├── archetypes
│ │ └── default.md
│ ├── config.toml
│ ├── content
│ │ ├── _index.ja.md
│ │ ├── reference
│ │ │ ├── _index.ja.md
│ │ │ ├── constraint
│ │ │ │ └── _index.ja.md
│ │ │ ├── function
│ │ │ │ └── _index.ja.md
│ │ │ └── record
│ │ │ │ └── _index.ja.md
│ │ ├── start
│ │ │ └── _index.ja.md
│ │ ├── syntax
│ │ │ ├── _index.ja.md
│ │ │ ├── advanced
│ │ │ │ └── _index.ja.md
│ │ │ ├── basic
│ │ │ │ └── _index.ja.md
│ │ │ └── entry
│ │ │ │ └── _index.ja.md
│ │ └── tutorial
│ │ │ ├── _index.ja.md
│ │ │ └── recycle
│ │ │ └── _index.ja.md
│ ├── hyde_y_config.toml
│ ├── images
│ │ ├── arc.png
│ │ ├── arc.svg
│ │ ├── arrow.png
│ │ ├── arrow.svg
│ │ ├── pita_examples.png
│ │ ├── recycle.png
│ │ └── recycle.svg
│ └── public
│ │ ├── css
│ │ ├── auto-complete.css
│ │ ├── featherlight.min.css
│ │ ├── font-awesome.min.css
│ │ ├── hugo-theme.css
│ │ ├── hybrid.css
│ │ ├── nucleus.css
│ │ ├── perfect-scrollbar.min.css
│ │ ├── theme-blue.css
│ │ ├── theme-green.css
│ │ ├── theme-red.css
│ │ └── theme.css
│ │ ├── en
│ │ ├── 404.html
│ │ ├── categories
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── index.html
│ │ ├── index.xml
│ │ ├── sitemap.xml
│ │ └── tags
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── Inconsolata.eot
│ │ ├── Inconsolata.svg
│ │ ├── Inconsolata.ttf
│ │ ├── Inconsolata.woff
│ │ ├── Novecentosanswide-Normal-webfont.eot
│ │ ├── Novecentosanswide-Normal-webfont.svg
│ │ ├── Novecentosanswide-Normal-webfont.ttf
│ │ ├── Novecentosanswide-Normal-webfont.woff
│ │ ├── Novecentosanswide-Normal-webfont.woff2
│ │ ├── Novecentosanswide-UltraLight-webfont.eot
│ │ ├── Novecentosanswide-UltraLight-webfont.svg
│ │ ├── Novecentosanswide-UltraLight-webfont.ttf
│ │ ├── Novecentosanswide-UltraLight-webfont.woff
│ │ ├── Novecentosanswide-UltraLight-webfont.woff2
│ │ ├── Work_Sans_200.eot
│ │ ├── Work_Sans_200.svg
│ │ ├── Work_Sans_200.ttf
│ │ ├── Work_Sans_200.woff
│ │ ├── Work_Sans_200.woff2
│ │ ├── Work_Sans_300.eot
│ │ ├── Work_Sans_300.svg
│ │ ├── Work_Sans_300.ttf
│ │ ├── Work_Sans_300.woff
│ │ ├── Work_Sans_300.woff2
│ │ ├── Work_Sans_500.eot
│ │ ├── Work_Sans_500.svg
│ │ ├── Work_Sans_500.ttf
│ │ ├── Work_Sans_500.woff
│ │ ├── Work_Sans_500.woff2
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ └── fontawesome-webfont.woff2
│ │ ├── images
│ │ ├── clippy.svg
│ │ ├── favicon.png
│ │ └── gopher-404.jpg
│ │ ├── index.html
│ │ ├── ja
│ │ ├── 404.html
│ │ ├── categories
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── index.html
│ │ ├── index.xml
│ │ ├── reference
│ │ │ ├── constraint
│ │ │ │ ├── index.html
│ │ │ │ └── index.xml
│ │ │ ├── function
│ │ │ │ ├── index.html
│ │ │ │ └── index.xml
│ │ │ ├── index.html
│ │ │ ├── index.xml
│ │ │ └── record
│ │ │ │ ├── index.html
│ │ │ │ └── index.xml
│ │ ├── sitemap.xml
│ │ ├── start
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── syntax
│ │ │ ├── advanced
│ │ │ │ ├── index.html
│ │ │ │ └── index.xml
│ │ │ ├── basic
│ │ │ │ ├── index.html
│ │ │ │ └── index.xml
│ │ │ ├── entry
│ │ │ │ ├── index.html
│ │ │ │ └── index.xml
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── tags
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ └── tutorial
│ │ │ ├── index.html
│ │ │ ├── index.xml
│ │ │ └── recycle
│ │ │ ├── index.html
│ │ │ └── index.xml
│ │ ├── js
│ │ ├── auto-complete.js
│ │ ├── clipboard.min.js
│ │ ├── featherlight.min.js
│ │ ├── highlight.pack.js
│ │ ├── html5shiv-printshiv.min.js
│ │ ├── hugo-learn.js
│ │ ├── jquery-2.x.min.js
│ │ ├── jquery.sticky.js
│ │ ├── learn.js
│ │ ├── lunr.min.js
│ │ ├── modernizr.custom.71422.js
│ │ ├── perfect-scrollbar.jquery.min.js
│ │ ├── perfect-scrollbar.min.js
│ │ └── search.js
│ │ ├── mermaid
│ │ ├── mermaid.css
│ │ ├── mermaid.dark.css
│ │ ├── mermaid.forest.css
│ │ └── mermaid.js
│ │ └── sitemap.xml
└── sitemap.xml
├── examples
├── 3rects.cgl
├── 3rects_1.cgl
├── align.cgl
├── bug1.cgl
├── cfg_test.cgl
├── cfg_test1.cgl
├── cfg_test2.cgl
├── common.cgl
├── constraint_dependency.cgl
├── context_free.cgl
├── context_free2.cgl
├── cross.cgl
├── data.cgl
├── dataplot.pita
├── dataplot2.cgl
├── debug1.cgl
├── debug_pita_p1.cgl
├── deform1.cgl
├── demo1.cgl
├── demo10.cgl
├── demo11.cgl
├── demo12.cgl
├── demo13.cgl
├── demo13_.cgl
├── demo13__.cgl
├── demo13___.cgl
├── demo14.cgl
├── demo15.cgl
├── demo2.cgl
├── demo2_.cgl
├── demo2__.cgl
├── demo2___.cgl
├── demo3.cgl
├── demo3_.cgl
├── demo4.cgl
├── demo5.cgl
├── demo5_.cgl
├── demo5__.cgl
├── demo6.cgl
├── demo7.cgl
├── demo8.cgl
├── demo9.cgl
├── demo_constraint.cgl
├── examples.cgl
├── fib1.cgl
├── fib2.cgl
├── fractal.cgl
├── fractal_.cgl
├── gradationMap.cgl
├── grid.cgl
├── import.cgl
├── integrate_data_.cgl
├── koch_curve.cgl
├── koch_snowflake.cgl
├── koch_snowflake_.cgl
├── logo.cgl
├── optimize_log.cgl
├── optimize_log_debug.cgl
├── optimize_log_full.cgl
├── optimize_log_min.cgl
├── path3.cgl
├── path4.cgl
├── path5.cgl
├── path6.cgl
├── path7.cgl
├── path7_.cgl
├── path8.cgl
├── pita_characteristics.cgl
├── pita_constraint_example.cgl
├── pita_constraints_process.cgl
├── pita_inclusion.cgl
├── pita_koch_example.cgl
├── pita_log_area
├── pita_log_averageOfAspectRatio
├── pita_log_averageOfDiagonalWidth
├── pita_log_divisionNum
├── pita_log_interval
├── pita_log_pp_time
├── pita_log_sumOfAspectRatio
├── pita_log_sumOfDiagonalWidth
├── pita_log_sumOfPerimeter
├── pita_log_velocity
├── pita_logo.cgl
├── pita_logo_.cgl
├── pita_logo__.cgl
├── pita_logo___.cgl
├── pita_p1.cgl
├── pita_p1_.cgl
├── pita_p2.cgl
├── pita_p3.cgl
├── pita_p3_.cgl
├── pita_p3_1.cgl
├── pita_p3__.cgl
├── pita_plot_data
├── pita_plot_p11
├── pita_plot_p11_0_25
├── pita_procedural_example.cgl
├── pita_shape_inheritance.cgl
├── pita_skeleton.cgl
├── pita_source_code.cgl
├── pita_syntax_basic.cgl
├── plot.cgl
├── plot_input.cgl
├── plot_log_2.cgl
├── plot_log_3.cgl
├── plot_log_4.cgl
├── quadtreeplot.pita
├── rec1.cgl
├── rec2.cgl
├── rec3.cgl
├── rec4.cgl
├── rec5.cgl
├── rec_acc.cgl
├── rec_shape1.cgl
├── rec_shape2.cgl
├── rec_shape3.cgl
├── rec_square.cgl
├── rec_square_.cgl
├── shapes_prototype.cgl
├── skeleton.cgl
├── skeleton2.cgl
├── skeleton3.cgl
├── str.cgl
├── syntax_test.cgl
├── syntax_test2.cgl
├── syntax_test3.cgl
├── test1.cgl
├── test2.cgl
├── test3.cgl
├── test4.cgl
├── text_packing.cgl
├── triforce.cgl
├── vartest.cgl
└── zonotope.cgl
├── external
├── Siv3D
│ ├── LICENSE
│ ├── Unicode.hpp
│ └── miniutf.hpp
└── cereal_compatible
│ └── cereal_boost_optional.hpp
├── include
└── Pita
│ ├── BinaryEvaluator.hpp
│ ├── ClosureMaker.hpp
│ ├── Context.hpp
│ ├── DynamicDeferredIdentifierSearcher.hpp
│ ├── Error.hpp
│ ├── Evaluator.hpp
│ ├── ExprTransformer.hpp
│ ├── FontDataJP
│ ├── FontShape.hpp
│ ├── Graph.hpp
│ ├── IntrinsicGeometricFunctions.hpp
│ ├── Licences
│ ├── CppNumericalSolvers
│ ├── Eigen
│ ├── OpenSiv3D
│ ├── cereal
│ ├── cxxopts
│ ├── geos_1
│ ├── geos_10
│ ├── geos_11
│ ├── geos_12
│ ├── geos_13
│ ├── geos_14
│ ├── geos_2
│ ├── geos_3
│ ├── geos_4
│ ├── geos_5
│ ├── geos_6
│ ├── geos_7
│ ├── geos_8
│ ├── geos_9
│ ├── libcmaes_1
│ ├── libcmaes_2
│ ├── libcmaes_3
│ ├── libcmaes_4
│ └── libcmaes_5
│ ├── Node.hpp
│ ├── OptimizationEvaluator.hpp
│ ├── Parser.hpp
│ ├── PitaStd
│ ├── Printer.hpp
│ ├── Program.hpp
│ ├── StaticDeferredIdentifierSearcher.hpp
│ ├── TreeLogger.hpp
│ ├── Util.hpp
│ ├── ValueCloner.hpp
│ └── Vectorizer.hpp
├── source
├── BinaryEvaluator.cpp
├── ClosureMaker.cpp
├── Context.cpp
├── DynamicDeferredIdentifierSearcher.cpp
├── Evaluator.cpp
├── ExprTransformer.cpp
├── FontShape.cpp
├── Geometry.cpp
├── Graph.cpp
├── IntrinsicGeometricFunctions.cpp
├── Node.cpp
├── OptimizationEvaluator.cpp
├── Parser.cpp
├── Printer.cpp
├── Program.cpp
├── ShapeRecordCompressor.cpp
├── ShapeRecordConverter.cpp
├── ShapeRecordInterpreter.cpp
├── Source.cpp
├── StaticDeferredIdentifierSearcher.cpp
├── TreeLogger.cpp
└── ValueCloner.cpp
└── test
├── CMakeLists.txt
├── pita_examples.cpp
└── pita_test.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | # Output files
35 | *.svg
36 | log.html
37 | Makefile
38 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "external/stb"]
2 | path = external/stb
3 | url = https://github.com/nothings/stb.git
4 | [submodule "external/libcmaes"]
5 | path = external/libcmaes
6 | url = https://github.com/agehama/libcmaes.git
7 | [submodule "external/CppNumericalSolvers"]
8 | path = external/CppNumericalSolvers
9 | url = https://github.com/PatWie/CppNumericalSolvers.git
10 | [submodule "external/Eigen"]
11 | path = external/Eigen
12 | url = https://github.com/agehama/eigen-git-mirror.git
13 | [submodule "external/geos"]
14 | path = external/geos
15 | url = https://github.com/agehama/geos.git
16 | [submodule "external/cxxopts"]
17 | path = external/cxxopts
18 | url = https://github.com/jarro2783/cxxopts.git
19 | [submodule "external/cereal"]
20 | path = external/cereal
21 | url = https://github.com/agehama/cereal.git
22 | [submodule "docs/pita_doc/themes/hugo-theme-learn"]
23 | path = docs/pita_doc/themes/hugo-theme-learn
24 | url = https://github.com/agehama/hugo-theme-learn.git
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 agehama
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Pita
2 | ===
3 |
4 | [](https://travis-ci.org/agehama/Pita)
5 |
6 | Constraint geometry processing language.
7 |
8 | ### Requirements
9 | - Boost 1.57
10 | - CMake 3.1
11 | - C++ compiler that supports C++17
12 |
13 | ### Build
14 |
15 | git clone --recursive https://github.com/agehama/Pita.git
16 | mkdir build ; cd !$
17 | cmake ../Pita
18 | make -j
19 |
20 | ### Run examples
21 |
22 | ./pita ../Pita/examples/3rects.cgl -o 3rects.svg
23 |
24 | ### Run test
25 |
26 | ctest -V
27 |
--------------------------------------------------------------------------------
/docs/css/auto-complete.css:
--------------------------------------------------------------------------------
1 | .autocomplete-suggestions {
2 | text-align: left;
3 | cursor: default;
4 | border: 1px solid #ccc;
5 | border-top: 0;
6 | background: #fff;
7 | box-shadow: -1px 1px 3px rgba(0,0,0,.1);
8 |
9 | /* core styles should not be changed */
10 | position: absolute;
11 | display: none;
12 | z-index: 9999;
13 | max-height: 254px;
14 | overflow: hidden;
15 | overflow-y: auto;
16 | box-sizing: border-box;
17 |
18 | }
19 | .autocomplete-suggestion {
20 | position: relative;
21 | cursor: pointer;
22 | padding: 7px;
23 | line-height: 23px;
24 | white-space: nowrap;
25 | overflow: hidden;
26 | text-overflow: ellipsis;
27 | color: #333;
28 | }
29 |
30 | .autocomplete-suggestion b {
31 | font-weight: normal;
32 | color: #1f8dd6;
33 | }
34 |
35 | .autocomplete-suggestion.selected {
36 | background: #333;
37 | color: #fff;
38 | }
39 |
40 | .autocomplete-suggestion:hover {
41 | background: #444;
42 | color: #fff;
43 | }
44 |
45 | .autocomplete-suggestion > .context {
46 | font-size: 12px;
47 | }
48 |
--------------------------------------------------------------------------------
/docs/css/featherlight.min.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Featherlight - ultra slim jQuery lightbox
3 | * Version 1.2.3 - http://noelboss.github.io/featherlight/
4 | *
5 | * Copyright 2015, Noël Raoul Bossart (http://www.noelboss.com)
6 | * MIT Licensed.
7 | **/
8 | @media all{.featherlight{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483647;text-align:center;white-space:nowrap;cursor:pointer;background:#333;background:rgba(0,0,0,0)}.featherlight:last-of-type{background:rgba(0,0,0,.8)}.featherlight:before{content:'';display:inline-block;height:100%;vertical-align:middle;margin-right:-.25em}.featherlight .featherlight-content{position:relative;text-align:left;vertical-align:middle;display:inline-block;overflow:auto;padding:25px 25px 0;border-bottom:25px solid transparent;min-width:30%;margin-left:5%;margin-right:5%;max-height:95%;background:#fff;cursor:auto;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{position:absolute;z-index:9999;top:0;right:0;line-height:25px;width:25px;cursor:pointer;text-align:center;font:Arial,sans-serif;background:#fff;background:rgba(255,255,255,.3);color:#000}.featherlight .featherlight-image{width:100%}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight iframe{border:0}}@media only screen and (max-width:1024px){.featherlight .featherlight-content{margin-left:10px;margin-right:10px;max-height:98%;padding:10px 10px 0;border-bottom:10px solid transparent}}
--------------------------------------------------------------------------------
/docs/css/hybrid.css:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
4 |
5 | */
6 |
7 | /*background color*/
8 | .hljs {
9 | display: block;
10 | overflow-x: auto;
11 | padding: 0.5em;
12 | background: #1d1f21;
13 | }
14 |
15 | /*selection color*/
16 | .hljs::selection,
17 | .hljs span::selection {
18 | background: #373b41;
19 | }
20 |
21 | .hljs::-moz-selection,
22 | .hljs span::-moz-selection {
23 | background: #373b41;
24 | }
25 |
26 | /*foreground color*/
27 | .hljs {
28 | color: #c5c8c6;
29 | }
30 |
31 | /*color: fg_yellow*/
32 | .hljs-title,
33 | .hljs-name {
34 | color: #f0c674;
35 | }
36 |
37 | /*color: fg_comment*/
38 | .hljs-comment,
39 | .hljs-meta,
40 | .hljs-meta .hljs-keyword {
41 | color: #707880;
42 | }
43 |
44 | /*color: fg_red*/
45 | .hljs-number,
46 | .hljs-symbol,
47 | .hljs-literal,
48 | .hljs-deletion,
49 | .hljs-link {
50 | color: #cc6666
51 | }
52 |
53 | /*color: fg_green*/
54 | .hljs-string,
55 | .hljs-doctag,
56 | .hljs-addition,
57 | .hljs-regexp,
58 | .hljs-selector-attr,
59 | .hljs-selector-pseudo {
60 | color: #b5bd68;
61 | }
62 |
63 | /*color: fg_purple*/
64 | .hljs-attribute,
65 | .hljs-code,
66 | .hljs-selector-id {
67 | color: #b294bb;
68 | }
69 |
70 | /*color: fg_blue*/
71 | .hljs-keyword,
72 | .hljs-selector-tag,
73 | .hljs-bullet,
74 | .hljs-tag {
75 | color: #81a2be;
76 | }
77 |
78 | /*color: fg_aqua*/
79 | .hljs-subst,
80 | .hljs-variable,
81 | .hljs-template-tag,
82 | .hljs-template-variable {
83 | color: #8abeb7;
84 | }
85 |
86 | /*color: fg_orange*/
87 | .hljs-type,
88 | .hljs-built_in,
89 | .hljs-builtin-name,
90 | .hljs-quote,
91 | .hljs-section,
92 | .hljs-selector-class {
93 | color: #de935f;
94 | }
95 |
96 | .hljs-emphasis {
97 | font-style: italic;
98 | }
99 |
100 | .hljs-strong {
101 | font-weight: bold;
102 | }
103 |
--------------------------------------------------------------------------------
/docs/en/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 404 Page not found
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
Error
50 |
51 |
52 |
Woops. Looks like this page doesn't exist ¯\_(ツ)_/¯.
53 |
54 |
Go to homepage
55 |

56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/en/categories/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Categories on Pita デザインのためのプログラミング言語
5 | https://agehama.github.io/Pita/en/categories/
6 | Recent content in Categories on Pita デザインのためのプログラミング言語
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/en/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pita デザインのためのプログラミング言語
5 | https://agehama.github.io/Pita/en/
6 | Recent content on Pita デザインのためのプログラミング言語
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/en/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | https://agehama.github.io/Pita/en/categories/
7 | 0
8 |
13 |
18 |
19 |
20 |
21 | https://agehama.github.io/Pita/en/
22 | 0
23 |
28 |
33 |
34 |
35 |
36 | https://agehama.github.io/Pita/en/tags/
37 | 0
38 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/en/tags/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Tags on Pita デザインのためのプログラミング言語
5 | https://agehama.github.io/Pita/en/tags/
6 | Recent content in Tags on Pita デザインのためのプログラミング言語
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/docs/fonts/Inconsolata.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Inconsolata.eot
--------------------------------------------------------------------------------
/docs/fonts/Inconsolata.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Inconsolata.ttf
--------------------------------------------------------------------------------
/docs/fonts/Inconsolata.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Inconsolata.woff
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-Normal-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-Normal-webfont.eot
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-Normal-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-Normal-webfont.ttf
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-Normal-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-Normal-webfont.woff
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-Normal-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-Normal-webfont.woff2
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-UltraLight-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-UltraLight-webfont.eot
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-UltraLight-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-UltraLight-webfont.ttf
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-UltraLight-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-UltraLight-webfont.woff
--------------------------------------------------------------------------------
/docs/fonts/Novecentosanswide-UltraLight-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Novecentosanswide-UltraLight-webfont.woff2
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_200.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_200.eot
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_200.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_200.ttf
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_200.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_200.woff
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_200.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_200.woff2
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_300.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_300.eot
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_300.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_300.ttf
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_300.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_300.woff
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_300.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_300.woff2
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_500.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_500.eot
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_500.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_500.ttf
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_500.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_500.woff
--------------------------------------------------------------------------------
/docs/fonts/Work_Sans_500.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/Work_Sans_500.woff2
--------------------------------------------------------------------------------
/docs/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/docs/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/docs/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/docs/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/docs/google4e66d2ec1da84183.html:
--------------------------------------------------------------------------------
1 | google-site-verification: google4e66d2ec1da84183.html
--------------------------------------------------------------------------------
/docs/images/clippy.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/images/favicon.png
--------------------------------------------------------------------------------
/docs/images/gopher-404.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/images/gopher-404.jpg
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 | https://agehama.github.io/Pita/ja
--------------------------------------------------------------------------------
/docs/ja/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 404 Page not found
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |

56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/ja/categories/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Categories on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/categories/
6 | Recent content in Categories on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | はじめに on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/
6 | Recent content in はじめに on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/pitajs/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | pita.js on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/pitajs/
6 | Recent content in pita.js on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/reference/constraint/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 組み込みの制約 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/constraint/
6 | Recent content in 組み込みの制約 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/reference/function/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 組み込みの関数 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/function/
6 | Recent content in 組み込みの関数 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/reference/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | リファレンス on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/
6 | Recent content in リファレンス on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/reference/record/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 組み込みのレコード on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/record/
6 | Recent content in 組み込みのレコード on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/start/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Windows / macOS / Linux on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/start/
6 | Recent content in Windows / macOS / Linux on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/syntax/advanced/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 上級編 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/advanced/
6 | Recent content in 上級編 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/syntax/basic/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 中級編 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/basic/
6 | Recent content in 中級編 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/syntax/entry/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 初級編 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/entry/
6 | Recent content in 初級編 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/syntax/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 構文 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/
6 | Recent content in 構文 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/tags/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Tags on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/tags/
6 | Recent content in Tags on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/tutorial/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | チュートリアル on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/tutorial/
6 | Recent content in チュートリアル on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/ja/tutorial/recycle/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | リサイクルマークを作る on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/tutorial/recycle/
6 | Recent content in リサイクルマークを作る on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/js/pita/pita.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/js/pita/pita.wasm
--------------------------------------------------------------------------------
/docs/pita_doc/archetypes/default.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "{{ replace .Name "-" " " | title }}"
3 | date: {{ .Date }}
4 | draft: true
5 | ---
6 |
7 |
--------------------------------------------------------------------------------
/docs/pita_doc/config.toml:
--------------------------------------------------------------------------------
1 | # hostname (and path) to the root eg. http://spf13.com/
2 | baseurl = "https://agehama.github.io/Pita/"
3 |
4 | # Site title
5 | title = "Pita デザインのためのプログラミング言語"
6 | theme = "hugo-theme-learn"
7 |
8 | # Metadata format
9 | # "yaml", "toml", "json"
10 | metaDataFormat = "yaml"
11 | defaultContentLanguageInSubdir= true
12 |
13 | # Copyright
14 | copyright = "(c) 2018 agehama."
15 |
16 | # Language
17 | languageCode = "ja-JP"
18 | defaultContentLanguage = "ja"
19 |
20 | [Languages]
21 | [Languages.ja]
22 | title = "Documentation for Pita"
23 | weight = 1
24 | languageName = "Japanese"
25 |
26 | [[Languages.ja.menu.shortcuts]]
27 | name = " Github repo"
28 | identifier = "ds"
29 | url = "https://github.com/agehama/Pita"
30 | weight = 10
31 |
32 | [[Languages.en.menu.shortcuts]]
33 | name = " License"
34 | url = "/license"
35 | weight = 30
--------------------------------------------------------------------------------
/docs/pita_doc/content/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "はじめに"
3 | ---
4 |
5 | # Pita - デザインのための言語
6 |
7 | Pitaは、グラフィックスデザインのためのプログラミング言語です。
8 | Pitaではルールを組み合わせることで作りたいグラフィックスの仕様を決めると、プログラムがその仕様を満たす結果を自動で生成します。
9 | これにより、ユーザーは難しい座標計算を行う必要はなく、欲しい結果がどんなものであるのかを記述するだけで済みます。
10 |
11 | ---
12 |
13 | 
14 |
15 | ### 1. 制約による図形記述
16 | Pitaの最大の特徴は、図を定義するのに座標やアルゴリズムを書く必要がないという点です。
17 | Pitaは図の定義に、図が満たすべき仕様(図形同士が接触している、平行である、...)を与えることができます。
18 | 処理系はこの仕様を満たす図形を自動的に計算します。
19 |
20 | ### 2. 図形の部品化
21 | Pitaは一度図形を作ったら、それを継承することで似たような図形を簡単に作ることができます。
22 | また、図形同士のブーリアン演算も行うことができます。
23 | さらに図形定義から他の図形定義を参照することもでき、作図工程のモジュール化を支援します。
24 |
25 | ### 3. 高い表現力
26 | Pitaは図形に関する高度な演算機能(図形をパスに沿うよう変形させる、障害物を迂回する経路を探索する、...)を提供します。
27 | また、分岐やループなどの制御構文、レコードやリストなどのデータ構造、第一級関数など汎用性の高い言語機能を備えているので、複雑な図形も簡潔に記述することが可能です。
28 |
29 | #### 他の特徴
30 | 他にもPitaは次のような特徴を備えています。
31 |
32 | - Windows, MacOS, Ubuntu のサポート
33 | - 数値計算による高速な制約計算
34 | - フォント対応
35 | - SVG出力対応
36 | - パスに関する演算機能
37 | - MITライセンス
38 |
--------------------------------------------------------------------------------
/docs/pita_doc/content/reference/constraint/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "組み込みの制約"
3 | weight: 30
4 | ---
5 |
6 | ### Pitaプログラム
7 |
8 | ---
9 |
--------------------------------------------------------------------------------
/docs/pita_doc/content/reference/function/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "組み込みの関数"
3 | weight: 10
4 | ---
5 |
6 | ### 変数の遮蔽
7 | ### リスト結合
8 | ### 参照演算子
9 | ### Free関数
10 | ### 関数の再帰呼び出し
11 | ### 最適化オプションを指定する
--------------------------------------------------------------------------------
/docs/pita_doc/content/reference/record/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "組み込みのレコード"
3 | weight: 20
4 | ---
5 |
6 | ### 式の区切り
7 | ### 関数を作る
8 | ### 制約をかける
9 | ### ポリゴンを定義する
10 | ### 乱数を使う
11 | ### テキストを表示する
12 | ### Print関数
13 |
--------------------------------------------------------------------------------
/docs/pita_doc/content/start/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "ダウンロードとインストール"
3 | weight: 10
4 | chapter: false
5 | ---
6 |
7 | ---
8 |
9 | ### Windows
10 | #### ダウンロード
11 |
12 | [Pita(v0.5.0) for win](https://github.com/agehama/Pita/releases/download/v_0.5.0/pita-0.5.0-alpha-x86-win.zip) からダウンロードしてください。
13 |
14 | #### サンプルの実行
15 | ダウンロードしたファイルを解凍したら、コマンドプロンプトを起動してpita.exeのあるディレクトリへ移動してください。
16 | そして、以下のコマンドを入力し、SVGファイルが出力されればインストールは成功です。
17 | ```
18 | ...\pita-0.5.0-alpha-x86-win> pita.exe examples/3rects.cgl -o 3rects.svg
19 | ```
20 |
21 | ---
22 | ### MacOS
23 | #### ダウンロード
24 |
25 | [Pita 0.5.0](https://github.com/agehama/Pita/releases/download/v_0.5.0/pita-0.5.0-alpha-x86-win.zip) からダウンロードしてください。
26 |
27 | #### サンプルの実行
28 | ダウンロードしたファイルを解凍したら、コマンドプロンプトを起動してpita.exeのあるディレクトリへ移動してください。
29 | そして、以下のコマンドを入力し、SVGファイルが出力されればインストールは成功です。
30 | ```
31 | ...\pita-0.5.0-alpha-x86-win>pita.exe examples/3rects.cgl -o 3rects.svg
32 | ```
33 |
34 |
35 | ---
36 | ### Ubuntu
37 | #### ダウンロード
38 |
39 | [Pita 0.5.0](https://github.com/agehama/Pita/releases/download/v_0.5.0/pita-0.5.0-alpha-x86-win.zip) からダウンロードしてください。
40 |
41 | #### サンプルの実行
42 | ダウンロードしたファイルを解凍したら、コマンドプロンプトを起動してpita.exeのあるディレクトリへ移動してください。
43 | そして、以下のコマンドを入力し、SVGファイルが出力されればインストールは成功です。
44 | ```
45 | ...\pita-0.5.0-alpha-x86-win>pita.exe examples/3rects.cgl -o 3rects.svg
46 | ```
47 |
48 |
49 | ---
50 |
51 | ### その他のOS
52 | 上記以外のOSの場合は、ソースコードからPitaをビルドすることができます。
53 | Pita(v0.5.0)のビルドに必要な要件は以下の通りです。
54 |
55 | - Boost 1.54
56 | - CMake 3.1
57 | - C++14をサポートするコンパイラ
58 | - ncurses
59 |
60 | 上記を満たす環境であれば、次のようにしてビルドすることができます。
61 | ```
62 | git clone --recursive https://github.com/agehama/Pita.git
63 | mkdir build
64 | cd build
65 | cmake ../Pita
66 | make -j
67 | ```
--------------------------------------------------------------------------------
/docs/pita_doc/content/syntax/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "構文"
3 | weight: 30
4 | ---
5 |
6 | ### 初級編
7 | - Pitaプログラム
8 | - 基本的な演算子
9 | - 変数の定義
10 | - リスト
11 | - レコード
12 | - 図形を呼び出す
13 | - ループ
14 | - 条件分岐
15 | - コメント
16 |
17 | ### 中級編
18 | - 式の区切り
19 | - 関数を作る
20 | - 制約をかける
21 | - ポリゴンを定義する
22 | - 乱数を使う
23 | - テキストを表示する
24 | - Print関数
25 |
26 | ### 上級編
27 | - 変数の遮蔽
28 | - リスト結合
29 | - 参照演算子
30 | - Free関数
31 | - 関数の再帰呼び出し
32 | - 最適化オプションを指定する
33 |
--------------------------------------------------------------------------------
/docs/pita_doc/content/syntax/advanced/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "上級編"
3 | weight: 30
4 | ---
5 |
6 | ### 変数の遮蔽
7 | ### リスト結合
8 | ### 参照演算子
9 | ### Free関数
10 | ### 関数の再帰呼び出し
11 | ### 最適化オプションを指定する
--------------------------------------------------------------------------------
/docs/pita_doc/content/syntax/basic/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "中級編"
3 | weight: 20
4 | ---
5 |
6 | ### 式の区切り
7 | ### 関数を作る
8 | ### 制約をかける
9 | ### ポリゴンを定義する
10 | ### 乱数を使う
11 | ### テキストを表示する
12 | ### Print関数
13 |
--------------------------------------------------------------------------------
/docs/pita_doc/content/syntax/entry/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "初級編"
3 | weight: 10
4 | ---
5 |
6 | ### Pitaプログラム
7 | Pitaのプログラムは複数の式が並んだものです。
8 | 処理系は上から式を順番に評価していき、最後に評価した値を結果として出力します。
9 |
10 | ---
11 |
12 | ### 基本的な演算子
13 | 通常のプログラミング言語と同じような演算子を使うことができます。
14 | 剰余はMod関数を使って求めることができます。
15 |
16 | #### 四則演算
17 |
18 | | 演算子 | 意味 |
19 | | ------ | ----------- |
20 | | +a | a の値 |
21 | | -a | -a の値 |
22 | | a + b | a + b |
23 | | a - b | a - b |
24 | | a * b | a × b |
25 | | a / b | a ÷ b |
26 | | a ^ b | a の b 乗 |
27 |
28 | #### 代入演算
29 |
30 | | 演算子 | 意味 |
31 | | ------ | ----------- |
32 | | a = b | a に b を代入 |
33 |
34 | #### 論理演算
35 |
36 | | 演算子 | 意味 |
37 | | ------ | ----------- |
38 | | !a | a の否定 |
39 | | a \| b | a または b |
40 | | a & b | a かつ b |
41 | | a < b | a が b より小さい |
42 | | a <= b | a が b 以下である |
43 | | a > b | a が b より大きい |
44 | | a >= b | a が b 以上である |
45 |
46 | ---
47 |
48 | ### 変数の定義
49 | `変数名 = 値`と書くことで変数を定義することができます。
50 | ```
51 | a = 4
52 | b = 5
53 | a + b
54 | ```
55 |
56 | 新しい変数の定義と、既に存在する変数への代入はどちらも=演算子によって行われます。
57 | したがって、=の左辺の変数がすでに存在したら再代入、存在しなかったら変数の定義とみなされます。
58 | ```
59 | a = 4 //変数定義
60 | a = 5 //再代入
61 | a
62 | ```
63 |
64 | ---
65 |
66 | ### リスト
67 | []で囲むことで値のリストを作ることができます。
68 | ```
69 | xs = [1, 2, 3]
70 | xs[0]
71 | ```
72 |
73 | ```
74 | xs = [1, 2, 3]
75 | xs[0]
76 | ```
77 |
78 | ---
79 |
80 | ### レコード
81 |
82 | ---
83 |
84 | ### 図形を呼び出す
85 |
86 | ---
87 |
88 | ### ループ
89 |
90 | ---
91 |
92 | ### 条件分岐
93 |
94 | ---
95 |
96 | ### コメント
--------------------------------------------------------------------------------
/docs/pita_doc/content/tutorial/_index.ja.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "チュートリアル"
3 | weight: 20
4 | ---
5 |
6 | #### いくつかの使用例を紹介しながら、Pitaの使い方について説明します。
7 |
8 | ---
9 | ### [1. リサイクルマークを作る]({{%relref "/tutorial/recycle/_index.md" %}})
10 |
11 | 
12 |
13 | ---
14 |
--------------------------------------------------------------------------------
/docs/pita_doc/images/arc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/images/arc.png
--------------------------------------------------------------------------------
/docs/pita_doc/images/arc.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/docs/pita_doc/images/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/images/arrow.png
--------------------------------------------------------------------------------
/docs/pita_doc/images/arrow.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/docs/pita_doc/images/pita_examples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/images/pita_examples.png
--------------------------------------------------------------------------------
/docs/pita_doc/images/recycle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/images/recycle.png
--------------------------------------------------------------------------------
/docs/pita_doc/public/css/auto-complete.css:
--------------------------------------------------------------------------------
1 | .autocomplete-suggestions {
2 | text-align: left;
3 | cursor: default;
4 | border: 1px solid #ccc;
5 | border-top: 0;
6 | background: #fff;
7 | box-shadow: -1px 1px 3px rgba(0,0,0,.1);
8 |
9 | /* core styles should not be changed */
10 | position: absolute;
11 | display: none;
12 | z-index: 9999;
13 | max-height: 254px;
14 | overflow: hidden;
15 | overflow-y: auto;
16 | box-sizing: border-box;
17 |
18 | }
19 | .autocomplete-suggestion {
20 | position: relative;
21 | cursor: pointer;
22 | padding: 7px;
23 | line-height: 23px;
24 | white-space: nowrap;
25 | overflow: hidden;
26 | text-overflow: ellipsis;
27 | color: #333;
28 | }
29 |
30 | .autocomplete-suggestion b {
31 | font-weight: normal;
32 | color: #1f8dd6;
33 | }
34 |
35 | .autocomplete-suggestion.selected {
36 | background: #333;
37 | color: #fff;
38 | }
39 |
40 | .autocomplete-suggestion:hover {
41 | background: #444;
42 | color: #fff;
43 | }
44 |
45 | .autocomplete-suggestion > .context {
46 | font-size: 12px;
47 | }
48 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/css/featherlight.min.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Featherlight - ultra slim jQuery lightbox
3 | * Version 1.2.3 - http://noelboss.github.io/featherlight/
4 | *
5 | * Copyright 2015, Noël Raoul Bossart (http://www.noelboss.com)
6 | * MIT Licensed.
7 | **/
8 | @media all{.featherlight{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483647;text-align:center;white-space:nowrap;cursor:pointer;background:#333;background:rgba(0,0,0,0)}.featherlight:last-of-type{background:rgba(0,0,0,.8)}.featherlight:before{content:'';display:inline-block;height:100%;vertical-align:middle;margin-right:-.25em}.featherlight .featherlight-content{position:relative;text-align:left;vertical-align:middle;display:inline-block;overflow:auto;padding:25px 25px 0;border-bottom:25px solid transparent;min-width:30%;margin-left:5%;margin-right:5%;max-height:95%;background:#fff;cursor:auto;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight .featherlight-close-icon{position:absolute;z-index:9999;top:0;right:0;line-height:25px;width:25px;cursor:pointer;text-align:center;font:Arial,sans-serif;background:#fff;background:rgba(255,255,255,.3);color:#000}.featherlight .featherlight-image{width:100%}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0}.featherlight iframe{border:0}}@media only screen and (max-width:1024px){.featherlight .featherlight-content{margin-left:10px;margin-right:10px;max-height:98%;padding:10px 10px 0;border-bottom:10px solid transparent}}
--------------------------------------------------------------------------------
/docs/pita_doc/public/css/hybrid.css:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
4 |
5 | */
6 |
7 | /*background color*/
8 | .hljs {
9 | display: block;
10 | overflow-x: auto;
11 | padding: 0.5em;
12 | background: #1d1f21;
13 | }
14 |
15 | /*selection color*/
16 | .hljs::selection,
17 | .hljs span::selection {
18 | background: #373b41;
19 | }
20 |
21 | .hljs::-moz-selection,
22 | .hljs span::-moz-selection {
23 | background: #373b41;
24 | }
25 |
26 | /*foreground color*/
27 | .hljs {
28 | color: #c5c8c6;
29 | }
30 |
31 | /*color: fg_yellow*/
32 | .hljs-title,
33 | .hljs-name {
34 | color: #f0c674;
35 | }
36 |
37 | /*color: fg_comment*/
38 | .hljs-comment,
39 | .hljs-meta,
40 | .hljs-meta .hljs-keyword {
41 | color: #707880;
42 | }
43 |
44 | /*color: fg_red*/
45 | .hljs-number,
46 | .hljs-symbol,
47 | .hljs-literal,
48 | .hljs-deletion,
49 | .hljs-link {
50 | color: #cc6666
51 | }
52 |
53 | /*color: fg_green*/
54 | .hljs-string,
55 | .hljs-doctag,
56 | .hljs-addition,
57 | .hljs-regexp,
58 | .hljs-selector-attr,
59 | .hljs-selector-pseudo {
60 | color: #b5bd68;
61 | }
62 |
63 | /*color: fg_purple*/
64 | .hljs-attribute,
65 | .hljs-code,
66 | .hljs-selector-id {
67 | color: #b294bb;
68 | }
69 |
70 | /*color: fg_blue*/
71 | .hljs-keyword,
72 | .hljs-selector-tag,
73 | .hljs-bullet,
74 | .hljs-tag {
75 | color: #81a2be;
76 | }
77 |
78 | /*color: fg_aqua*/
79 | .hljs-subst,
80 | .hljs-variable,
81 | .hljs-template-tag,
82 | .hljs-template-variable {
83 | color: #8abeb7;
84 | }
85 |
86 | /*color: fg_orange*/
87 | .hljs-type,
88 | .hljs-built_in,
89 | .hljs-builtin-name,
90 | .hljs-quote,
91 | .hljs-section,
92 | .hljs-selector-class {
93 | color: #de935f;
94 | }
95 |
96 | .hljs-emphasis {
97 | font-style: italic;
98 | }
99 |
100 | .hljs-strong {
101 | font-weight: bold;
102 | }
103 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/en/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 404 Page not found
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
Error
48 |
49 |
50 |
Woops. Looks like this page doesn't exist ¯\_(ツ)_/¯.
51 |
52 |
Go to homepage
53 |

54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/en/categories/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Categories on Pita デザインのためのプログラミング言語
5 | https://agehama.github.io/Pita/en/categories/
6 | Recent content in Categories on Pita デザインのためのプログラミング言語
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/en/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Pita デザインのためのプログラミング言語
5 | https://agehama.github.io/Pita/en/
6 | Recent content on Pita デザインのためのプログラミング言語
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/en/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | https://agehama.github.io/Pita/en/categories/
7 | 0
8 |
13 |
18 |
19 |
20 |
21 | https://agehama.github.io/Pita/en/
22 | 0
23 |
28 |
33 |
34 |
35 |
36 | https://agehama.github.io/Pita/en/tags/
37 | 0
38 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/en/tags/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Tags on Pita デザインのためのプログラミング言語
5 | https://agehama.github.io/Pita/en/tags/
6 | Recent content in Tags on Pita デザインのためのプログラミング言語
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Inconsolata.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Inconsolata.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Inconsolata.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Inconsolata.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Inconsolata.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Inconsolata.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-Normal-webfont.woff2
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Novecentosanswide-UltraLight-webfont.woff2
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_200.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_200.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_200.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_200.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_200.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_200.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_200.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_200.woff2
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_300.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_300.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_300.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_300.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_300.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_300.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_300.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_300.woff2
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_500.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_500.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_500.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_500.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_500.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_500.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/Work_Sans_500.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/Work_Sans_500.woff2
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/docs/pita_doc/public/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/docs/pita_doc/public/images/clippy.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/images/favicon.png
--------------------------------------------------------------------------------
/docs/pita_doc/public/images/gopher-404.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/agehama/Pita/26f469d5236a9babe39991bea517135d311a8ca1/docs/pita_doc/public/images/gopher-404.jpg
--------------------------------------------------------------------------------
/docs/pita_doc/public/index.html:
--------------------------------------------------------------------------------
1 | https://agehama.github.io/Pita/ja
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 404 Page not found
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |

54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/categories/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Categories on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/categories/
6 | Recent content in Categories on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | はじめに on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/
6 | Recent content in はじめに on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/reference/constraint/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 組み込みの制約 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/constraint/
6 | Recent content in 組み込みの制約 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/reference/function/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 組み込みの関数 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/function/
6 | Recent content in 組み込みの関数 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/reference/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | リファレンス on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/
6 | Recent content in リファレンス on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/reference/record/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 組み込みのレコード on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/reference/record/
6 | Recent content in 組み込みのレコード on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/start/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ダウンロードとインストール on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/start/
6 | Recent content in ダウンロードとインストール on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/syntax/advanced/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 上級編 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/advanced/
6 | Recent content in 上級編 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/syntax/basic/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 中級編 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/basic/
6 | Recent content in 中級編 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/syntax/entry/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 初級編 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/entry/
6 | Recent content in 初級編 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/syntax/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 構文 on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/syntax/
6 | Recent content in 構文 on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/tags/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Tags on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/tags/
6 | Recent content in Tags on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/tutorial/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | チュートリアル on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/tutorial/
6 | Recent content in チュートリアル on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/ja/tutorial/recycle/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | リサイクルマークを作る on Documentation for Pita
5 | https://agehama.github.io/Pita/ja/tutorial/recycle/
6 | Recent content in リサイクルマークを作る on Documentation for Pita
7 | Hugo -- gohugo.io
8 | ja-JP
9 | (c) 2018 agehama.
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/pita_doc/public/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | https://agehama.github.io/Pita/en/sitemap.xml
6 |
7 |
8 |
9 |
10 | https://agehama.github.io/Pita/ja/sitemap.xml
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/docs/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | https://agehama.github.io/Pita/en/sitemap.xml
6 |
7 |
8 |
9 |
10 | https://agehama.github.io/Pita/ja/sitemap.xml
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/examples/3rects.cgl:
--------------------------------------------------------------------------------
1 | main = Shape{
2 | a: Square{scale = {x: 30, y: 30}, fill: {r: 255, g: 0, b: 0}}
3 | b: Square{scale = {x: 40, y: 40}, fill: {r: 0, g: 255, b: 0}}
4 | c: Square{scale = {x: 50, y: 50}, fill: {r: 0, g: 0, b: 255}}
5 |
6 | sat( Contact(a.topRight(), b.bottomLeft()) & Contact(a.bottomRight(), c.topLeft()) )
7 | sat( Contact(b.bottomRight(), c.topRight()) )
8 | //var(b.pos in {x: [0, 10], y: [20, 30]}, c.pos in {x: [-10, 10], y: [45, 55]}, c.angle in [90, 180])
9 | var(b.pos in [-200, 200], c.pos in [-200, 200], c.angle in [0, 90])
10 | }
11 |
--------------------------------------------------------------------------------
/examples/3rects_1.cgl:
--------------------------------------------------------------------------------
1 | {
2 | cubes: [
3 | Square{scale: X2(30)}
4 | Square{scale: X2(40)}
5 | Square{scale: X2(60)}
6 | ]
7 |
8 | sat( Contact(cubes[0].topRight(), cubes[1].bottomLeft() ) )
9 | sat( Contact(cubes[1].bottomRight(), cubes[2].topRight() ) )
10 | sat( Contact(cubes[2].topLeft(), cubes[0].bottomRight()) )
11 | var(cubes[[1, 2]].pos, cubes[[1, 2]].angle)
12 | }
13 |
--------------------------------------------------------------------------------
/examples/align.cgl:
--------------------------------------------------------------------------------
1 | /*AlignHCenter([
2 | Square{scale: X2(100)},
3 | Space(10),
4 | Triangle{scale: X2(70)},
5 | Space(10),
6 | Circle{scale: X2(50)}
7 | ])
8 | */
9 |
10 | a = AlignH([Square{scale:X2(100)}, Triangle{scale:X2(100)}, Circle{scale:X2(100)}])
11 | b = AlignH([Triangle{scale:X2(100)}, Circle{scale:X2(100)}, Square{scale:X2(50)}])
12 | AlignV([a,b])
--------------------------------------------------------------------------------
/examples/bug1.cgl:
--------------------------------------------------------------------------------
1 | Square{
2 | Print(left().x)
3 | sat(left().x == 0)
4 | var(pos.x)
5 | }
--------------------------------------------------------------------------------
/examples/cfg_test.cgl:
--------------------------------------------------------------------------------
1 | main = {
2 | a: 0
3 | sat( (a=1,b=a+1,a=3,a+b) == 10 )
4 | var(a)
5 | }
--------------------------------------------------------------------------------
/examples/cfg_test1.cgl:
--------------------------------------------------------------------------------
1 | funcA = (x -> x^3 + 1)
2 | funcB = (x -> x^2 + 2)
3 |
4 | main = {
5 | a: 0
6 | sat( (if 10 < a then(funcA(a)) else(funcB(a))) == 150 )
7 | var(a)
8 | }
--------------------------------------------------------------------------------
/examples/cfg_test2.cgl:
--------------------------------------------------------------------------------
1 | funcA = (x -> x^3 + 1)
2 |
3 | main = {
4 | a: 0
5 | sat(
6 | funcB = 0
7 | if 5 < a
8 | then funcB = (x -> x^2 + 2)
9 | else funcB = (x -> x + 200)
10 | (
11 | if 10 < a
12 | then(funcA(a))
13 | else(funcB(a))
14 | ) == 150
15 | )
16 | var(a)
17 | }
--------------------------------------------------------------------------------
/examples/constraint_dependency.cgl:
--------------------------------------------------------------------------------
1 | main = Shape{
2 | ss: []
3 | num = 70
4 | for i in 0:num-1 do(
5 | ss[i] = Square{
6 | scale = {x: 30, y: 30}
7 | pos = {x: 45*i, y:200*Sin(170*i)}
8 | angle = i*35
9 | }
10 | var(ss[i].pos, ss[i].angle)
11 | )
12 | for i in 0:num/2-1 do(
13 | sat( Contact(ss[i*2].bottomRight(), ss[i*2+1].bottomLeft()) )
14 | )
15 | }
16 |
--------------------------------------------------------------------------------
/examples/context_free.cgl:
--------------------------------------------------------------------------------
1 | EnableGC(true)
2 |
3 | x = y + 1
4 | y = z * 3 + x
5 | z = 5
6 |
7 | Print(x)
--------------------------------------------------------------------------------
/examples/context_free2.cgl:
--------------------------------------------------------------------------------
1 | EnableGC(true)
2 |
3 | x\_4 = 1
4 | y\_4 = 1
5 |
6 | x = y + 1
7 | y = x * 2
8 |
9 | Print(x)
--------------------------------------------------------------------------------
/examples/cross.cgl:
--------------------------------------------------------------------------------
1 | stick = Shape{
2 | scale = {x:1, y:3}
3 | polygon: [
4 | {x: -1, y: -1}, {x: +1, y: -1}
5 | {x: +1, y: +1}, {x: -1, y: +1}
6 | ]
7 | }
8 |
9 | plus = Shape{
10 | scale = {x:50, y:50}
11 | a: stick{}
12 | b: stick{angle = 90}
13 | }
14 |
15 | cross = Shape{
16 | pos = {x:256, y:256}
17 | a: plus{angle = 45}
18 | fill: {r: 255, g: 0, b: 0}
19 | }
20 |
--------------------------------------------------------------------------------
/examples/data.cgl:
--------------------------------------------------------------------------------
1 | [Vec2(0.15817,0.149919),Vec2(0.946726,0.941067),Vec2(0.550026,0.719032),Vec2(0.226312,0.529303),Vec2(0.0539329,0.171329),Vec2(0.36953,0.0797004),Vec2(0.145778,0.727021),Vec2(0.5,0.5),Vec2(0.532745,0.460074),Vec2(0.00286248,0.99245),Vec2(0.51344,0.900693),Vec2(0.30772,0.14337)]
--------------------------------------------------------------------------------
/examples/debug1.cgl:
--------------------------------------------------------------------------------
1 | func = (->
2 | a = 10
3 | Print(a)
4 | 1
5 | )
6 |
7 | main = Shape{
8 | sat(func())
9 | }
10 |
--------------------------------------------------------------------------------
/examples/debug_pita_p1.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 | accentColor = Rgb(68, 84, 106)
4 |
5 | main = {
6 | centerCircle: Circle(100){scale: X2(100)}
7 | circlePath = ShapeOuterPath(centerCircle)[0]
8 | rect = Shape{a: Diff(Triangle{scale: X2(80)}, Triangle{scale: X2(60)})}
9 |
10 | gearNum = 4
11 | delta = 0.5 / gearNum
12 | a: for i in 1:gearNum list(
13 | DeformShapeByPath(rect,
14 | SubPath(circlePath, delta*(i*2), delta*(i*2+1.5)))
15 | )
16 |
17 | fill: mainColor
18 | }
--------------------------------------------------------------------------------
/examples/deform1.cgl:
--------------------------------------------------------------------------------
1 | arcPath = (r, begin, end, num ->
2 | {
3 | delta = 1.0*(end - begin)/num
4 | line: for i in 0:num list(
5 | angle = begin + delta*i
6 | Vec2(r*Cos(angle), r*Sin(angle))
7 | )
8 | })
9 |
10 | arrow = Shape{
11 | body: Square{scale = Vec2(20, 200), sat(Contact(bottom(), Vec2(0, 0))), var(pos)}
12 | head: Triangle{scale = Vec2(50, 50), sat(Contact(bottom(), body.top())), var(pos)}
13 | begin: (->globalPos(body.bottom()))
14 | end: (->globalPos(head.top()))
15 | length: (->length(Sub(begin(), end())))
16 | }
17 |
18 | main = Shape{
19 | a = arrow{}
20 | b: DeformShapeByPath2(a, arcPath(100, 0, 120, 50), a.begin(), a.end())
21 | c: DeformShapeByPath2(a, arcPath(100, 120, 240, 50), a.begin(), a.end())
22 | d: DeformShapeByPath2(a, arcPath(100, 240, 360, 50), a.begin(), a.end())
23 | }
24 |
25 | main2 = Shape{
26 | a = arrow{}
27 | p = ShapeOuterPath(Shape{s:Buffer(Triangle{scale= X2(100)}, 30)})[0]
28 | b: DeformShapeByPath2(a, p, a.begin(), a.end())
29 | }
--------------------------------------------------------------------------------
/examples/demo1.cgl:
--------------------------------------------------------------------------------
1 | tri = Shape{
2 | a = Triangle{scale=X2(50), angle: 90}
3 | b = SymDiff(a, Shape{s:a,scale:X2(1.5), angle: 15})
4 | c: SymDiff(b, Shape{s:b,scale:X2(2.0), angle: 15})
5 | }
6 |
7 | pita = Shape{
8 | text2: (a = BuildText("Pita"), b = a{scale: X2(2)}, Buffer(b, -2))
9 | }
10 |
11 | main = Shape{
12 | s: {
13 | a: tri{angle: -90}
14 | b: pita{}
15 | sat( b.scale.x == b.scale.y )
16 | sat( BoundingBox(a).height() == BoundingBox(b).height() )
17 | var(b.scale)
18 | }
19 | sat(Contact(Right(BoundingBox(s.a)), Moved(Left(BoundingBox(s.b)), -50, 0) ))
20 | var(s.b.pos)
21 | fill: Rgb(0, 0, 0)
22 | //fill: Rgb(255, 255, 255)
23 | }
24 |
--------------------------------------------------------------------------------
/examples/demo10.cgl:
--------------------------------------------------------------------------------
1 | grid = FrameGrid(Square{scale:Vec2(20, 40)}, Vec2(5, 5))
2 |
3 | main = Shape{
4 | cs: 10 of (->Circle(10){scale: 5})
5 | for i in 0:Size(cs)-1 do(
6 | sat( Contact(Center(grid(i, 0)), cs[i].pos) )
7 | )
8 | var(cs[*].pos)
9 | }
10 |
--------------------------------------------------------------------------------
/examples/demo11.cgl:
--------------------------------------------------------------------------------
1 | innerCircle = (p1,p2,p3 -> Shape{
2 | radius: 10
3 | center: Vec2(0, 0)
4 | polygon: (->
5 | GlobalShape(Circle(10){scale: radius, pos: center}).polygon
6 | )
7 | sat(Contact(polygon, [p1, p2]) & Contact(polygon, [p2, p3]))
8 | var(center)
9 | })
10 |
11 | main = Shape{
12 | circle1: innerCircle(Vec2(0,0), Vec2(30,-5), Vec2(10,50))
13 | circle2: circle1{radius: 50}
14 | }
--------------------------------------------------------------------------------
/examples/demo12.cgl:
--------------------------------------------------------------------------------
1 | inscribedCircle = (p1, p2, p3 -> Shape{
2 | radius: 10
3 | center: Vec2(0, 0)
4 | polygon: (->
5 | GlobalShape(Circle{scale: radius, pos: center}).polygon
6 | )
7 | sat(Touch(polygon, Line(p1, p2)) & Touch(polygon, Line(p2, p3)) & Touch(polygon, Line(p3, p1)))
8 | var(radius, center)
9 | })
10 |
11 | perpendicular = (dir->Shape{
12 | begin: Vec2(0, 0)
13 | length: 1
14 | line: (->[begin, begin + dir*length])
15 | end: (->begin + dir*length)
16 | var(length)
17 | })
18 |
19 | getPerpendicular = (p0, p1, center ->
20 | perpendicular(Normal([p0, p1])){
21 | begin = circle.center
22 | sat(Contact(line, [p0, p1]))
23 | }
24 | )
25 |
26 | main = Shape{
27 | a = Vec2(0,0)
28 | b = Vec2(30,-5)
29 | c = Vec2(10,50)
30 | circle: innerCenterCircle(a, b, c)
31 |
32 | i = circle.center
33 |
34 | lines: [
35 | getPerpendicular(a, b, i)
36 | getPerpendicular(b, c, i)
37 | getPerpendicular(c, a, i)
38 | ]
39 |
40 | d = lines[0].end()
41 | e = lines[1].end()
42 | f = lines[2].end()
43 | }
--------------------------------------------------------------------------------
/examples/demo13__.cgl:
--------------------------------------------------------------------------------
1 | EnableGC(true)
2 |
3 | main = Shape{
4 | a = Vec2(200, 0)
5 | b = Vec2(300, 150)
6 | c = Vec2(0, 150)
7 |
8 | tri = MakeTriangle(a,b,c)
9 |
10 | outerCirclePos = (a+b+c)/3.0
11 | outerCircleRadius = 5.0
12 |
13 | innerCirclePos = (a+b+c)/3.0
14 | innerCircleRadius = 5.0
15 |
16 | line: (->[[a, b],[c, b],[a, c]])
17 |
18 | innerCircle: Shape{polygon:(->
19 | GlobalShape(Circle{scale: X2(innerCircleRadius), pos: innerCirclePos}).polygon
20 | )}
21 |
22 | outerCircle: Shape{polygon:(->
23 | GlobalShape(Circle{scale: X2(outerCircleRadius), pos: outerCirclePos}).polygon
24 | )}
25 |
26 | sat( Cmaes(innerCircleRadius),
27 | Touch(Line(a, b), innerCircle) &
28 | Touch(Line(c, b), innerCircle) &
29 | Touch(Line(a, c), innerCircle)
30 | )
31 | sat(
32 | Touch(a, ShapeOuterPath(outerCircle)) &
33 | Touch(b, ShapeOuterPath(outerCircle)) &
34 | Touch(c, ShapeOuterPath(outerCircle))
35 | )
36 | //var(innerCirclePos in makeTriangle(a,b,c), innerCircleRadius in [1.0, 150])
37 | var(innerCirclePos, innerCircleRadius)
38 | var(outerCirclePos, outerCircleRadius)
39 |
40 | stroke: Rgb(100, 100, 100)
41 | fill: 0
42 | }
43 |
44 | main
--------------------------------------------------------------------------------
/examples/demo13___.cgl:
--------------------------------------------------------------------------------
1 | EnableGC(true)
2 |
3 | main = Shape{
4 | a: Vec2(200, 0), b: Vec2(300, 150), c: Vec2(0, 150)
5 | tri: MakeTriangle(a, b, c){fill: 0, stroke: Rgb(100, 100, 100)}
6 | //line: [[a, b],[c, b],[a, c]]
7 | triangleCircle = Shape{fill: 0
8 | p: (a+b+c)/3.0, r: 5.0, var(p, r)
9 | circle: Shape{polygon:(->GlobalShape(Circle{scale: X2(r), pos: p}).polygon)}
10 | }
11 | outer: triangleCircle{stroke: Rgb(222, 158, 48)
12 | sat(Touch(a, ShapeOuterPath(circle)) &
13 | Touch(b, ShapeOuterPath(circle)) &
14 | Touch(c, ShapeOuterPath(circle)))
15 | }
16 | inner: triangleCircle{stroke: Rgb(49, 187, 222)
17 | sat(Cmaes(r),
18 | Touch(Line(a, b), circle) &
19 | Touch(Line(c, b), circle) &
20 | Touch(Line(a, c), circle))
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/examples/demo14.cgl:
--------------------------------------------------------------------------------
1 | tree = Shape{
2 | gen = (depth -> if depth < 10
3 | then Shape{
4 | node: Square{}
5 | child1: rec(depth + 1){}
6 | child2: rec(depth + 1){}
7 | sat: ! Touch(node, child1) & Touch(node, child2) !
8 | var: ? child1.pos, child1.angle, child2.pos, child2.angle ?
9 | }
10 | else Shape{ leaf: Square{} }
11 | )
12 | root: gen(0)
13 | sat: ! AABB(self).height < Fold(Sum, Map(root.**.leaf, (s->AABB(s).width))) !
14 | var: ? root.**.node.pos, root.**.node.angle ?
15 | }
16 |
--------------------------------------------------------------------------------
/examples/demo15.cgl:
--------------------------------------------------------------------------------
1 | city = Shape{
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/examples/demo2.cgl:
--------------------------------------------------------------------------------
1 | //EnableTimeLimit(110)
2 |
3 | /*
4 | Combination = (list, binaryFunc ->
5 | sum = 0.0
6 | for i in 0:Size(list)-2 do(
7 | for j in i+1:Size(list)-1 do(
8 | sum = sum + binaryFunc(list[i], list[j])
9 | )
10 | )
11 | sum
12 | )
13 |
14 | main = Shape{
15 | s: [
16 | Text("北海道")
17 | Text("山形県")
18 | Text("滋賀県")
19 | Text("石川県")
20 | ]
21 |
22 | for i in 0:Size(s)-1 do(
23 | s[i].pos = Vec2(Random(-100,100),Random(-100,100))
24 | )
25 |
26 | f = (a, b -> width=35, Area(BoundingBox(Intersect(Buffer(a,width), Buffer(b,width))))^2 )
27 | sat( Cmaes(s[1]), Combination(s, f) )
28 | sat( Area(BoundingBox(Shape{a:s})) )
29 | var(s[[1,2,3]].pos)
30 | fill: Rgb(0, 0, 0)
31 | }
32 | */
33 |
34 |
35 | main = Shape{
36 | s: [
37 | Text("北海道")
38 | Text("山形県")
39 | Text("滋賀県")
40 | Text("石川県")
41 | ]
42 |
43 | for i in 0:Size(s)-1 do(
44 | s[i].pos = Vec2(Random(-100,100),Random(-100,100))
45 | )
46 |
47 | //f = (a, b -> width=35, Area(BoundingBox(Intersect(Buffer(a,width), Buffer(b,width))))^2 )
48 | f = (a, b -> width=35, Area(BoundingBox(Intersect(Buffer(a,width), Buffer(b,width)))) )
49 |
50 | sat( Cmaes(s),
51 | (sum = 0.0
52 | for i in 0:Size(s)-2 do(
53 | for j in i+1:Size(s)-1 do(
54 | sum = sum + f(s[i], s[j])
55 | )
56 | )
57 | sum)
58 | )
59 | sat( Area(BoundingBox(Shape{a:s})) )
60 | var(s[[1,2,3]].pos)
61 | fill: Rgb(0, 0, 0)
62 | }
--------------------------------------------------------------------------------
/examples/demo2_.cgl:
--------------------------------------------------------------------------------
1 | EnableTimeLimit(110)
2 |
3 | Combination = (list, binaryFunc ->
4 | sum = 0.0
5 | for i in 0:Size(list)-2 do(
6 | for j in i+1:Size(list)-1 do(
7 | sum = sum + binaryFunc(list[i], list[j])
8 | )
9 | )
10 | sum
11 | )
12 |
13 | main = Shape{
14 | a: Text("北海道")
15 | b: Text("山形県")
16 | c: Text("滋賀県")
17 | d: Text("石川県")
18 |
19 | sat( Touch(a, Union(b,c,d)) &
20 | Touch(b, Union(a,c,d)) &
21 | Touch(c, Union(a,b,d)) &
22 | Touch(d, Union(a,b,c)) )
23 |
24 | minimize( Area(BoundingBox(a,b,c,d)) )
25 |
26 | fill: Rgb(0, 0, 0)
27 | }
28 |
29 | main = Shape{
30 | shapes: ["北海道", "山形県", "滋賀県", "石川県"] * (a -> Text(a))
31 |
32 | forall s in shapes do(
33 | sat( Touch(s, Union(Except(shapes, s))) )
34 | )
35 |
36 | //shapes * ( a -> Touch(a, Except(shapes, a)) )
37 |
38 | shapes * ( a -> Touch(a, shapes #Except a) )
39 |
40 | //shapes * ( a -> a #Touch Except(shapes, a) )
41 |
42 | minimize( Area(BoundingBox(shapes)) )
43 |
44 | fill: Rgb(0, 0, 0)
45 | }
46 |
47 | Conj = Fold(a, b -> a & b.)
48 |
49 | main = Shape{
50 | shapes: ["北海道", "山形県", "滋賀県", "石川県"] #Map \a -> Text(a).
51 |
52 | ! shapes #Map \a -> Touch(a, shapes #Except a). #Fold Conj !
53 |
54 | > Area(BoundingBox(shapes)) <
55 |
56 | ? shapes[*].pos ?
57 |
58 | fill: Rgb(0, 0, 0)
59 | }
60 |
61 |
62 | ((list * f) * g)
63 |
64 | (list * (f * g))
65 |
66 | list |> f |> g
67 |
68 |
69 | 畳み込み演算子 *
70 | パイプライン演算子 |>
71 |
72 |
73 | (g * f)(x) = g(f(x))
74 |
75 |
--------------------------------------------------------------------------------
/examples/demo2__.cgl:
--------------------------------------------------------------------------------
1 | Shape{
2 | shapes: [
3 | Text("Apple")
4 | Text("Orange")
5 | Text("Lemon")
6 | Text("Melon")
7 | ]
8 |
9 | //f = (a, b -> margin=10, Area(BoundingBox(Intersect(ConvexHull(Buffer(a,margin)), ConvexHull(Buffer(b,margin))))) )
10 | f = (a, b -> margin=10, Area(Intersect(ConvexHull(Buffer(a,margin)), ConvexHull(Buffer(b,margin)))) )
11 |
12 | sat(
13 | Cmaes(shapes),
14 | sum = 0.0
15 | for i in 0:Size(shapes)-1 do(
16 | others = []
17 | for j in 0:Size(shapes)-2 do(
18 | index = Mod(i+1+j, Size(shapes))
19 | Push(others, shapes[index])
20 | )
21 |
22 | sum = sum + f(shapes[i], others)
23 | )
24 | sum + Area(BoundingBox(Shape{s:shapes}))^0.75
25 | )
26 | var(shapes[*].pos in [0, 300])
27 | }
--------------------------------------------------------------------------------
/examples/demo2___.cgl:
--------------------------------------------------------------------------------
1 | Shape{
2 | shapes: [
3 | Text("Apple")
4 | Text("Orange")
5 | Text("Lemon")
6 | ]
7 |
8 | f = (a, b -> margin=10, Touch(Buffer(a,margin), Buffer(b,margin)) )
9 |
10 | sat(
11 | Cmaes(shapes),
12 | sum = 0.0
13 | for i in 0:Size(shapes)-1 do(
14 | others = []
15 | for j in 0:Size(shapes)-2 do(
16 | index = Mod(i+1+j, Size(shapes))
17 | Push(others, shapes[index])
18 | )
19 |
20 | sum = sum + f(shapes[i], others)
21 | )
22 | sum + Area(BoundingBox(Shape{s:shapes}))
23 | )
24 | var(shapes[*].pos in [0, 300])
25 | }
--------------------------------------------------------------------------------
/examples/demo3.cgl:
--------------------------------------------------------------------------------
1 |
2 | shapes = [
3 | Shape{
4 | a: Square{scale: Vec2(10,100)}
5 | b: Square{scale: Vec2(100,10)}
6 |
7 | contacts: [
8 | [(->globalPos(TopLeft(a))), (->globalPos(TopRight(a)))]
9 | [(->globalPos(BottomRight(a))), (->globalPos(BottomLeft(a)))]
10 | [(->globalPos(BottomLeft(b))), (->globalPos(TopLeft(b)))]
11 | [(->globalPos(TopRight(b))), (->globalPos(BottomRight(b)))]
12 | ]
13 | }
14 | Free(Shape{
15 | a: Square{scale: Vec2(50,10)}
16 | b: Square{scale: Vec2(50,10), angle: -30}
17 | sat(Contact(BottomRight(a), BottomLeft(b)))
18 | var(b.pos)
19 |
20 | contacts: [
21 | [(->globalPos(BottomLeft(a))), (->globalPos(TopLeft(a)))]
22 | [(->globalPos(Top(b))), (->globalPos(Right(b)))]
23 | ]
24 | })
25 | ]
26 |
27 | contactEdge = (edgeA, edgeB ->
28 | Contact(edgeA[0](), edgeB[1]()) & Contact(edgeA[1](), edgeB[0]())
29 | )
30 |
31 | main = Shape{
32 | ss: [
33 | (_ = shapes[0], _{})
34 | (_ = shapes[1], _{})
35 | (_ = shapes[1], _{})
36 | (_ = shapes[0], _{})
37 | (_ = shapes[1], _{})
38 | ]
39 |
40 | sat( contactEdge(ss[0].contacts[2], ss[1].contacts[0]) )
41 | sat( contactEdge(ss[1].contacts[1], ss[2].contacts[1]) )
42 | sat( contactEdge(ss[2].contacts[0], ss[3].contacts[0]) )
43 | sat( contactEdge(ss[3].contacts[3], ss[4].contacts[0]) )
44 |
45 | var(ss[[1,2,3,4]].pos, ss[[1,2,3,4]].angle)
46 | }
--------------------------------------------------------------------------------
/examples/demo3_.cgl:
--------------------------------------------------------------------------------
1 |
2 | shapes = [
3 | Shape{
4 | a: Square{scale: Vec2(10,100)}
5 | b: Square{scale: Vec2(100,10)}
6 |
7 | contacts: [
8 | [(->globalPos(TopLeft(a))), (->globalPos(TopRight(a)))]
9 | [(->globalPos(BottomRight(a))), (->globalPos(BottomLeft(a)))]
10 | [(->globalPos(BottomLeft(b))), (->globalPos(TopLeft(b)))]
11 | [(->globalPos(TopRight(b))), (->globalPos(BottomRight(b)))]
12 | ]
13 | }
14 | Free(Shape{
15 | a: Square{scale: Vec2(50,10)}
16 | b: Square{scale: Vec2(50,10), angle: -30}
17 | sat(Contact(BottomRight(a), BottomLeft(b)))
18 | var(b.pos)
19 |
20 | contacts: [
21 | [(->globalPos(BottomLeft(a))), (->globalPos(TopLeft(a)))]
22 | [(->globalPos(Top(b))), (->globalPos(Right(b)))]
23 | ]
24 | })
25 | ]
26 |
27 | contactEdge = (edgeA, edgeB ->
28 | Contact(edgeA[0](), edgeB[1]()) & Contact(edgeA[1](), edgeB[0]())
29 | )
30 |
31 | main = Shape{
32 | ss: for i in 0:10 list(
33 | _ = shapes[Random(0,1)]
34 | _{}
35 | )
36 |
37 | for i in 1:Size(ss)-1 do(
38 | var(ss[i].pos, ss[i].angle)
39 | i0 = Random(0, Size(ss[i-1].contacts)-1)
40 | i1 = Random(0, Size(ss[i].contacts)-1)
41 | sat( contactEdge(ss[i-1].contacts[i0], ss[i].contacts[i1]) )
42 | )
43 | }
--------------------------------------------------------------------------------
/examples/demo4.cgl:
--------------------------------------------------------------------------------
1 | main = Shape{
2 | circle: (_ = Circle(100), _{scale: X2(200)})
3 | arrows: for i in 1:10 list(Arrow{angle: i/10.0*360.0, pos: Vec2(500*Cos(i/10.0*360.0+90), 500*Sin(i/10.0*360.0+90))})
4 | lines: for i in 0:Size(arrows)-1 list(
5 | /*sat(Distance(ShapeOuterPath(circle), arrows[i].end())*100 == 0)
6 | sat(Parallel([arrows[i].begin(), arrows[i].end()], [arrows[i].end(), circle.pos]))
7 | var(arrows[i].pos)*/
8 | (_ = Circle(30), _{scale: X2(10), pos = BoundingBox(arrows[i].beginLine()).center})
9 | )
10 | }
--------------------------------------------------------------------------------
/examples/demo5.cgl:
--------------------------------------------------------------------------------
1 | main = Shape{
2 | width: 100.0
3 | height: 100.0
4 | polygon: (->GetPolygon(Square{scale: Vec2(width, height)}))
5 | sat(width * 5 == height)
6 | var(width)
7 | }
8 |
9 | func = (px -> scale = 10.0, x = px/scale, x*Log(x)*Cos(x)*scale)
10 |
11 | curvedArrow = Shape{
12 | line: for i in 0:30 list( x = 300.0*Random(0.0,1.0), Vec2(x, func(x)) )
13 | p0: Vec2(0, 100*Sin(0))
14 | p1: Vec2(100, 100*Sin(110))
15 | p2: Vec2(200, 100*Sin(220))
16 | p3: Vec2(300, 100*Sin(330))
17 | thickness: 10
18 |
19 | polygon: (->
20 | divSize = 50
21 | centerLine = CubicBezier(p0, p1, p2, p3, divSize)
22 | OffsetPath(centerLine, thickness*0.5).line @ Reverse(OffsetPath(centerLine, -thickness*0.5).line)
23 | )
24 | sat(Parallel([p0, p1], [p2, p3]))
25 | var(p2)
26 | }
27 |
--------------------------------------------------------------------------------
/examples/demo5_.cgl:
--------------------------------------------------------------------------------
1 | func = (px -> scale = 100.0, x = px/scale, x*Log(x)*CosRad(x)*scale)
2 |
3 | curvedArrow = Shape{
4 | jitter = 30.0
5 | points = for i in 0:30 list( x = 400.0*Random(0.0,1.0), Vec2(x, func(x)+Random(-jitter,jitter)) )
6 | plots: for i in 0:Size(points)-1 list(Square{
7 | pos: points[i]
8 | scale: X2(5)
9 | fill: Rgb(0,0,0)
10 | })
11 |
12 | p0: Vec2(0,0), p1: Vec2(10,0), p2: Vec2(20,0), p3: Vec2(30,0)
13 | thickness: 10
14 |
15 | divSize = 50
16 | line: (->CubicBezier(p0, p1, p2, p3, divSize).line)
17 | sat(
18 | sum = 0.0
19 | curve = CubicBezier(p0, p1, p2, p3, divSize)
20 | for i in 0:Size(points)-1 do(
21 | sum = sum + Distance(points[i], curve)^2
22 | )
23 | sum + Area(BoundingBox(curve))^0.75
24 | )
25 | var(p0, p1, p2, p3)
26 | stroke: Rgb(0,0,0)
27 | }
28 |
--------------------------------------------------------------------------------
/examples/demo5__.cgl:
--------------------------------------------------------------------------------
1 | main = Shape{
2 | width: 100.0
3 | height: 100.0
4 | polygon: (->GetPolygon(Square{scale: Vec2(width, height)}))
5 | sat(width * 5 == height)
6 | var(width)
7 | }
8 |
9 | func = (px -> scale = 100.0, x = px/scale, x*Log(x)*CosRad(x)*scale)
10 |
11 | curvedArrow = Shape{
12 | points = for i in 0:30 list( x = 400.0*Random(0.0,1.0), Vec2(x, func(x)) )
13 | plots: for i in 0:Size(points)-1 list(Square{
14 | pos: points[i]
15 | scale: X2(5)
16 | fill: Rgb(0,0,0)
17 | })
18 |
19 | p0: Vec2(0,0)
20 | p1: Vec2(10,0)
21 | p2: Vec2(20,0)
22 | p3: Vec2(30,0)
23 | thickness: 10
24 |
25 | divSize = 50
26 | /*polygon: (->
27 | centerLine = CubicBezier(p0, p1, p2, p3, divSize)
28 | OffsetPath(centerLine, thickness*0.5).line @ Reverse(OffsetPath(centerLine, -thickness*0.5).line)
29 | )*/
30 | line: (->CubicBezier(p0, p1, p2, p3, divSize).line)
31 | //line: (->[Vec2(0, 0), Vec2(100,0), Vec2(0,100), Vec2(100,100)])
32 | sat(
33 | sum = 0.0
34 | curve = CubicBezier(p0, p1, p2, p3, divSize)
35 | for i in 0:Size(points)-1 do(
36 | sum = sum + Distance(points[i], curve)^2
37 | )
38 | sum + Area(BoundingBox(curve))^0.5
39 | )
40 | var(p0, p1, p2, p3)
41 | stroke: Rgb(0,0,0)
42 | }
43 |
--------------------------------------------------------------------------------
/examples/demo6.cgl:
--------------------------------------------------------------------------------
1 | Print({x: 2, y: 3} + {x: 6, y: 3})
--------------------------------------------------------------------------------
/examples/demo7.cgl:
--------------------------------------------------------------------------------
1 | //bind1st = (f, x -> (y -> f(x, y)))
2 | //bind2nd = (f, y -> (x -> f(x, y)))
3 |
4 | main = Shape
5 | {
6 | width: 100
7 | height: 50
8 | angleX: 15
9 | angleY: 0
10 | polygon: (->
11 | GlobalShape(
12 | Skew(Square{scale: Vec2(width, height)}.ellipse(), angleX, angleY)
13 | ).polygon
14 | )
15 | }
--------------------------------------------------------------------------------
/examples/demo8.cgl:
--------------------------------------------------------------------------------
1 | main = Shape
2 | {
3 | a: Circle(100){pos: Vec2(100,100), scale:50}
4 | b: Circle(100){pos: Vec2(300,100), scale:50}
5 |
6 | /*
7 | obstacles: for i in 1:5 list(
8 | Circle(100){pos: RandomIn(Square{scale:X2(500)}), scale:25}
9 | )
10 | */
11 | obstacles: 5 of (->
12 | Circle(100){pos: RandomIn(Square{scale:X2(500)}), scale:25}
13 | )
14 |
15 | center = (a.pos + b.pos)/2
16 | path = Path([a.pos, b.pos])
17 |
18 | maxLength = Length(center - a.pos)
19 | sqrtHeight: 0
20 |
21 | line: (->
22 | PathMap(path, (pos, norm ->
23 | distance = Length(center - pos)
24 | pos + norm * (distance / maxLength) * sqrtHeight
25 | )).line
26 | )
27 |
28 | stroke: Rgb(0,0,0)
29 | stroke_width: 5
30 |
31 | sat( NotIntersect(line, obstacles) )
32 | var(sqrtHeight)
33 | }
34 |
--------------------------------------------------------------------------------
/examples/demo9.cgl:
--------------------------------------------------------------------------------
1 | main = Shape
2 | {
3 | circles: {
4 | cs: 5 of (->Circle(100){pos: RandomIn(Square{scale:X2(500)}), scale:25})
5 | sat( BinaryEach(cs, (a,b->NotIntersect(a,b)) ) )
6 | var(cs[*].pos)
7 | }.cs
8 |
9 | arrows: []
10 | for i in 0:Size(circles)-2 do(
11 | for j in i:Size(circles)-1 do(
12 | Push(arrows, [circles[i], circles[j]])
13 | )
14 | )
15 |
16 | arrowHeights: Size(arrows) of (->0)
17 |
18 | polygon: (->
19 | for i in 0:Size(arrows)-1 list(
20 | a = arrows[i][0]
21 | b = arrows[i][1]
22 | center = (a.pos + b.pos)/2
23 | path = Path([a.pos, b.pos])
24 | Deform(
25 | Arrow{},
26 | PathMap(path, (pos, norm ->
27 | distance = Length(center - pos)
28 | pos + norm * (distance / maxLength) * arrowHeights[i]
29 | ))
30 | ).polygon
31 | )
32 | )
33 |
34 | sat( NotIntersect(polygon, circles) )
35 | var(arrowHeights)
36 | }
37 |
--------------------------------------------------------------------------------
/examples/demo_constraint.cgl:
--------------------------------------------------------------------------------
1 | /*answer = {
2 | x: 0.0, y: 0.0
3 | sat(x == -y + 3)
4 | sat(2*x + 5*y == 9)
5 | var(x, y)
6 | }
7 | */
8 |
9 | answer = {
10 | x: 0.0
11 | sat(5*x^2 - 11*x == -6)
12 | var(x)
13 | }
14 |
15 | Print(answer)
--------------------------------------------------------------------------------
/examples/examples.cgl:
--------------------------------------------------------------------------------
1 | import "rec_shape2.cgl" as rec2
2 | import "koch_snowflake.cgl" as koch
3 | import "pita_p2.cgl" as p2
4 | import "pita_constraint_example.cgl" as cs
5 |
6 | Center = (shape -> Square{polygon=BoundingBox(shape).result.polygon}.center())
7 | Left = (shape -> Square{polygon=BoundingBox(shape).result.polygon}.left())
8 | Right = (shape -> Square{polygon=BoundingBox(shape).result.polygon}.right())
9 |
10 | main = Shape{
11 | a: (s = rec2.tree, s{})
12 | b: (s = koch.tree, s{scale: X2(0.4), pos: Vec2(500,0)})
13 | c: (s = p2.main, s{scale: X2(0.5), pos: Vec2(800,0)})
14 | d: (s = cs.main, s{scale: X2(2.0), pos: Vec2(1200,0)})
15 | sat((Center(a).y - Center(b).y)^2 == 0)
16 | sat((Center(b).y - Center(c).y)^2 == 0)
17 | sat((Center(c).y - Center(d).y)^2 == 0)
18 | var(b.pos.y, c.pos.y, d.pos.y)
19 | }
20 |
21 | s = Free(main)
22 | main2 = s{
23 | dd = (Right(s.a).x - Left(s.b).x)
24 | sat( (dd - (Right(b).x - Left(c).x))^2 == 0)
25 | sat( (dd - (Right(c).x - Left(d).x))^2 == 0)
26 | var(c.pos.x, d.pos.x)
27 | }
--------------------------------------------------------------------------------
/examples/fib1.cgl:
--------------------------------------------------------------------------------
1 | fib = (x, f ->
2 | if x <= 1
3 | then 1
4 | else f(x-1, f) + f(x-2, f)
5 | )
6 |
7 | Print(fib(23, fib))
8 |
--------------------------------------------------------------------------------
/examples/fib2.cgl:
--------------------------------------------------------------------------------
1 | memo = [1, 1]
2 | fib = (x, fib ->
3 | if x <= 1
4 | then 1
5 | else
6 | if memo[x] != 0
7 | then memo[x]
8 | else memo[x] = fib(x-1, fib) + fib(x-2, fib)
9 | )
10 |
11 | Print(fib(45, fib))
12 |
--------------------------------------------------------------------------------
/examples/fractal.cgl:
--------------------------------------------------------------------------------
1 | koch_template = (p, q ->
2 | vby3 = (q - p) / 3.0
3 | nby3 = SetLength(Vec2(q.y - p.y, p.x - q.x),
4 | 0.5*Sqrt(3.0)*Length(vby3))
5 | ps = [p, p + vby3,
6 | (p + q)*0.5 + nby3, p + vby3*2, q]
7 | for i in 0:Size(ps)-2 list( [ps[i], ps[i+1]] )
8 | )
9 |
10 | rec_curve = (f, depth, ps ->
11 | if depth == 0 then { line: ps }
12 | else {
13 | ss = koch_template(ps[0], ps[1])
14 | b: for i in 0:3 list( f(f, depth-1, ss[i]) )
15 | }
16 | )
17 |
18 | tree = Shape{
19 | tri = Triangle{scale = {x: 10, y: 10}}
20 | ps = [[tri.p0(), tri.p1()], [tri.p1(), tri.p2()], [tri.p2(), tri.p0()]]
21 | a: Shape{
22 | l: for i in 0:2 list( rec_curve(rec_curve, 4, ps[i]) )
23 | }
24 | stroke: {r: 91, g: 155, b: 213}
25 | scale: X2(30)
26 | }
27 |
--------------------------------------------------------------------------------
/examples/fractal_.cgl:
--------------------------------------------------------------------------------
1 | koch_template = (p, q ->
2 | vby3 = (q - p) / 3.0
3 | nby3 = SetLength(Vec2(q.y - p.y, p.x - q.x),
4 | 0.5*Sqrt(3.0)*Length(vby3))
5 | ps = [p, p + vby3,
6 | (p + q)*0.5 + nby3, p + vby3*2, q]
7 | for i in 0:Size(ps)-2 list( [ps[i], ps[i+1]] )
8 | )
9 |
10 | rec_curve = (depth, ps ->
11 | if depth == 0 then { line: ps }
12 | else {
13 | ss = koch_template(ps[0], ps[1])
14 | b: for i in 0:3 list( rec_curve(depth-1, ss[i]) )
15 | }
16 | )
17 |
18 | tree = Shape{
19 | tri = Triangle{scale = {x: 10, y: 10}}
20 | ps = [[tri.p0(), tri.p1()], [tri.p1(), tri.p2()], [tri.p2(), tri.p0()]]
21 | a: Shape{
22 | l: for i in 0:2 list( rec_curve(1, ps[i]) )
23 | }
24 | stroke: {r: 91, g: 155, b: 213}
25 | scale: X2(100)
26 | }
27 |
28 | tree
--------------------------------------------------------------------------------
/examples/grid.cgl:
--------------------------------------------------------------------------------
1 | main = Shape{
2 | ss: []
3 | rect = Square{scale = X2(20)}
4 | i = 0
5 | interval = 25
6 | for yi in 0:9 do(
7 | for xi in 0:9 do(
8 | ss[i] =
9 | (if Random(0,1) < 0.3
10 | then rect{
11 | pos.x = interval*xi
12 | pos.y = interval*yi
13 | }
14 | else {})
15 | i = i+1
16 | )
17 | )
18 | }
--------------------------------------------------------------------------------
/examples/import.cgl:
--------------------------------------------------------------------------------
1 | koch_curve = import "koch_curve.cgl"
2 |
3 | main = koch_curve.tree{
4 | scale: {x: 2, y:3}
5 | stroke: {r: 0, g: 0, b: 0}
6 | }
7 |
--------------------------------------------------------------------------------
/examples/koch_curve.cgl:
--------------------------------------------------------------------------------
1 | div3 = (p, q -> {x: (q.x - p.x) / 3.0, y: (q.y - p.y) / 3.0})
2 |
3 | koch_template = (p, q ->
4 | v = Sub(p, q)
5 | n = {x: -v.y, y: v.x}
6 | vby3 = div3(p, q)
7 | m = Div(Add(p, q), 2.0)
8 | nby3 = SetLength(n, 0.5*Sqrt(3.0)*Length(vby3))
9 | m1 = Add(p, vby3)
10 | m2 = Add(m1, vby3)
11 | ps = [p, m1, Add(m, nby3), m2, q]
12 | [[ps[0], ps[1]], [ps[1], ps[2]], [ps[2], ps[3]], [ps[3], ps[4]]]
13 | )
14 |
15 | rec_curve = (f, depth, template, ps ->
16 | if depth == 0
17 | then {
18 | line: ps
19 | }
20 | else {
21 | ss = template(ps[0], ps[1])
22 | b: [
23 | f(f, depth-1, template, ss[0])
24 | f(f, depth-1, template, ss[1])
25 | f(f, depth-1, template, ss[2])
26 | f(f, depth-1, template, ss[3])
27 | ]
28 | }
29 | )
30 |
31 | curve = (depth -> Shape{
32 | a: Shape{
33 | c: rec_curve(rec_curve, depth, koch_template, [{x:0,y:0}, {x:10,y:0}])
34 | scale = X2(70)
35 | }
36 | stroke: Rgb(0, 0, 0)
37 | })
38 |
39 | snowflake = (depth -> Shape{
40 | tri = Square{scale = {x: 10, y: 10}}
41 | a: Shape{
42 | l: [
43 | rec_curve(rec_curve, depth, koch_template, [tri.topLeft(), tri.topRight()])
44 | rec_curve(rec_curve, depth, koch_template, [tri.topRight(), tri.bottomRight()])
45 | rec_curve(rec_curve, depth, koch_template, [tri.bottomRight(), tri.bottomLeft()])
46 | rec_curve(rec_curve, depth, koch_template, [tri.bottomLeft(), tri.topLeft()])
47 | ]
48 | scale = X2(70)
49 | }
50 | stroke: Rgb(0, 0, 0)
51 | })
52 |
53 | main = (s = snowflake(5), s{
54 | angle = 45
55 | })
--------------------------------------------------------------------------------
/examples/koch_snowflake.cgl:
--------------------------------------------------------------------------------
1 | div3 = (p, q -> {x: (q.x - p.x) / 3.0, y: (q.y - p.y) / 3.0})
2 |
3 | koch_template = (p, q ->
4 | v = Sub(p, q)
5 | n = {x: -v.y, y: v.x}
6 | vby3 = div3(p, q)
7 | m = Div(Add(p, q), 2.0)
8 | nby3 = SetLength(n, 0.5*Sqrt(3.0)*Length(vby3))
9 | m1 = Add(p, vby3)
10 | m2 = Add(m1, vby3)
11 | ps = [p, m1, Add(m, nby3), m2, q]
12 | [[ps[0], ps[1]], [ps[1], ps[2]], [ps[2], ps[3]], [ps[3], ps[4]]]
13 | )
14 |
15 | rec_curve = (f, depth, template, ps ->
16 | if depth == 0
17 | then {
18 | line: ps
19 | }
20 | else {
21 | ss = template(ps[0], ps[1])
22 | b: [
23 | f(f, depth-1, template, ss[0])
24 | f(f, depth-1, template, ss[1])
25 | f(f, depth-1, template, ss[2])
26 | f(f, depth-1, template, ss[3])
27 | ]
28 | }
29 | )
30 |
31 | tree = Shape{
32 | tri = Triangle{scale = {x: 10, y: 10}}
33 | depth = 6
34 | a: Shape{
35 | l: [
36 | rec_curve(rec_curve, depth, koch_template, [tri.p0(), tri.p1()])
37 | rec_curve(rec_curve, depth, koch_template, [tri.p1(), tri.p2()])
38 | rec_curve(rec_curve, depth, koch_template, [tri.p2(), tri.p0()])
39 | ]
40 | scale = X2(70)
41 | }
42 | stroke: {r: 91, g: 155, b: 213}
43 | }
44 |
--------------------------------------------------------------------------------
/examples/koch_snowflake_.cgl:
--------------------------------------------------------------------------------
1 | koch_template = (p, q ->
2 | vby3 = (q - p) / 3.0
3 | nby3 = SetLength(Vec2(q.y - p.y, p.x - q.x), 0.5*Sqrt(3.0)*Length(vby3))
4 | ps = [p, p + vby3, (p + q)*0.5 + nby3, p + vby3*2, q]
5 | for i in 0:Size(ps)-2 list( [ps[i], ps[i+1]] )
6 | )
7 |
8 | rec_curve = (f, depth, template, ps ->
9 | if depth == 0 then { line: ps }
10 | else {
11 | ss = template(ps[0], ps[1])
12 | b: for i in 0:3 list(f(f, depth-1, template, ss[i]))
13 | }
14 | )
15 |
16 | tree = Shape{
17 | tri = Triangle{scale = {x: 10, y: 10}}
18 | depth = 5
19 | ps = [[tri.p0(), tri.p1()], [tri.p1(), tri.p2()], [tri.p2(), tri.p0()]]
20 | a: Shape{
21 | l: for i in 0:2 list(
22 | rec_curve(rec_curve, depth, koch_template, ps[i])
23 | )
24 | scale = X2(70)
25 | }
26 | stroke: {r: 91, g: 155, b: 213}
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/examples/logo.cgl:
--------------------------------------------------------------------------------
1 | getLeft = (shape -> Square{polygon=BoundingBox(shape).result.polygon}.left())
2 | getRight = (shape -> Square{polygon=BoundingBox(shape).result.polygon}.right())
3 |
4 | tri = Shape{
5 | a = Triangle{scale=X2(50), angle: 90}
6 | b = SymDiff(a, Shape{s:a,scale:X2(1.5), angle: 15})
7 | c: SymDiff(b, Shape{s:b,scale:X2(2.0), angle: 15})
8 | Print(c)
9 | }
10 |
11 | pita = Shape{
12 | //text: (Text("Pita")){scale: X2(2.0)}
13 | text: (a = Text("Pita"), Buffer(a{scale: X2(3.3)}, -1.5))
14 | rect = BoundingBox(text)
15 | rect2 = Square{polygon=rect.polygon}
16 | }
17 |
18 | main = Shape{
19 | a: tri{scale: X2(0.6), angle: -90}
20 | b: pita{}
21 | //sat(Contact(Moved(Right(a), 10,0), Left(b)))
22 | sat(Contact(Right(a), Moved(Left(b), -20, 0) ))
23 | var(b.pos)
24 | //fill: Rgb(255,255,255)
25 | fill: Rgb(0,0,0)
26 | }
27 |
--------------------------------------------------------------------------------
/examples/optimize_log.cgl:
--------------------------------------------------------------------------------
1 | {
2 | size: 2
3 | labels: [
4 | "pos.x"
5 | "pos.y"
6 | ]
7 | data: [
8 |
--------------------------------------------------------------------------------
/examples/optimize_log_min.cgl:
--------------------------------------------------------------------------------
1 | {
2 | size: 3
3 | labels: [
4 | "circlePos.x"
5 | "circlePos.y"
6 | "radius"
7 | ]
8 | data: [
9 | [166.667, 100, 5, 185.706], [40.6431, 125.251, 96.9179, 331.488], [66.3102, 46.2251, 55.1748, 205.711], [56.5146, 148.932, 99.6497, 326.283], [290.308, 108.876, 98.1299, 215.19], [32.9585, 119.716, 30.4059, 234.34], [1.43505, 16.8697, 64.3366, 341.562], [263.529, 75.5494, 79.9949, 170.087], [108.388, 31.7886, 68.4546, 181.278], [119.622, 111.097, 48.0011, 136.065], [126.626, 26.0798, 30.8894, 178.626], [239.184, 47.4826, 87.3705, 163.152], [44.7342, 149.11, 82.3684, 316.67], [37.5548, 114.563, 49.5683, 232.756], [199.082, 18.8845, 21.8107, 124.199], [15.3649, 5.46619, 41.4644, 373.474], [137.397, 73.1353, 79.6035, 157.589], [276.262, 121.13, 70.8717, 218.75], [0.84553, 106.606, 64.7521, 206.373], [136.81, 116.088, 57.8017, 119.148], [263.027, 121.226, 2.75962, 174.235], [246.374, 123.126, 94.0673, 229.316], [123.8, 63.4748, 58.5147, 184.248], [47.4173, 114.26, 23.7855, 226.071], [242.92, 148.278, 33.9124, 190.728], [89.9495, 2.03087, 22.5065, 288.688], [272.209, 127.27, 95.5467, 248.09], [233.669, 148.119, 7.69194, 191.86]
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/examples/path3.cgl:
--------------------------------------------------------------------------------
1 | route = Shape{
2 | rect = Square{scale: {x: 60, y: 30}, pos: {x: 100, y: 100}, angle: 30}
3 | arrow: BuildPath([rect.top(), Moved(rect.right(), 200, 0)], 10){
4 | stroke: {r: 0, g: 255, b: 0}
5 | }
6 | arrow2: OffsetPath(arrow, 100.0){
7 | stroke: {r: 0, g: 255, b: 255}
8 | }
9 | arrow3 = ShapeOuterPath(rect)[0]{
10 | stroke: {r: 0, g: 0, b: 255}
11 | }
12 | textShape = Shape{
13 | a: Buffer(BuildText("図", arrow2){
14 | scale: {x: 20, y: 20}
15 | }, 20)
16 | }
17 | arrow4: Shape{
18 | paths: ShapePath(textShape)
19 | stroke: {r: 0, g: 0, b: 255}
20 | }
21 | ts: []
22 | for i in 0:Size(arrow4.paths)-1 do(
23 | ts[i] = BuildText("図形記述言語Pita 図形記述言語Pita 図形記述言語Pita 図形記述言語Pita 図形記述言語Pita", arrow4.paths[i])
24 | )
25 | }
26 |
--------------------------------------------------------------------------------
/examples/path4.cgl:
--------------------------------------------------------------------------------
1 | route = Shape{
2 | rect = Square{scale: {x: 60, y: 30}, pos: {x: 100, y: 100}, angle: 30}
3 | arrow: BuildPath([rect.top(), Moved(rect.right(), 200, 0)], 10){
4 | stroke: {r: 0, g: 255, b: 0}
5 | }
6 | arrow2: OffsetPath(arrow, 100.0){
7 | stroke: {r: 0, g: 255, b: 255}
8 | }
9 | arrow3 = FunctionPath(Sin, 0, 360*2, 100){
10 | scale: {x: 2, y: 100}
11 | stroke: {r: 255, g: 0, b: 0}
12 | }
13 | textShape: BuildText("図形記述言語Pita 図形記述言語Pita 図形記述言語Pita 図形記述言語Pita ", arrow3){
14 | }
15 | bound: Shape{
16 | a: ShapeOuterPath(BoundingBox(textShape))
17 | stroke: {r: 0, g: 255, b: 0}
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/examples/path5.cgl:
--------------------------------------------------------------------------------
1 | route = Shape{
2 | rect = Square{scale: {x: 60, y: 30}, pos: {x: 100, y: 100}, angle: 30}
3 | tri = hexagon{scale: {x:100, y:100}}
4 | arrow: BuildPath([rect.top(), Moved(rect.right(), 200, 0)], 10){
5 | stroke: {r: 0, g: 255, b: 0}
6 | }
7 | arrow2: OffsetPath(arrow, 100.0){
8 | stroke: {r: 0, g: 255, b: 255}
9 | }
10 | arrow3: FunctionPath(Sin, 0, 360*2, 100){
11 | scale: {x: 2, y: 100}
12 | stroke: {r: 255, g: 0, b: 0}
13 | }
14 | arrow4: OffsetPath(arrow3, -100){
15 | stroke: {r: 255, g: 128, b: 128}
16 | }
17 | arrow5: ShapeOuterPath(tri)[0]{
18 | stroke: {r: 0, g: 0, b: 255}
19 | }
20 | arrow6: OffsetPath(arrow5, -20){
21 | stroke: {r: 128, g: 128, b: 255}
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/examples/path6.cgl:
--------------------------------------------------------------------------------
1 | route = Shape{
2 | rect = Square{scale: {x: 60, y: 30}, pos: {x: 100, y: 100}, angle: 30}
3 | tri = hexagon{scale: {x:100, y:100}}
4 | textShape = BuildText("図形記述言語Pita"){
5 | }
6 | arrow3: FunctionPath(Sin, 0, 360, 100){
7 | scale: {x: 2, y:100}
8 | stroke: {r: 255, g: 128, b: 128}
9 | }
10 | result: Shape{
11 | a:DeformShapeByPath(textShape, arrow3)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/examples/path7_.cgl:
--------------------------------------------------------------------------------
1 | getParallelotope = (f, df, xmin, xmax ->
2 | xmid = (xmin + xmax)*0.5
3 | divnum = 100
4 |
5 | amid = 1.0*(f(xmax) - f(xmin)) / (xmax - xmin)
6 | amin = amid
7 | amax = amid
8 |
9 | dx = 1.0*(xmax - xmin) / divnum
10 | for i in 0:divnum do(
11 | a = df(xmin + i*dx)
12 | if(a < amin)then(amin = a)
13 | if(amax < a)then(amax = a)
14 | )
15 |
16 | xhalf = xmax - xmid
17 |
18 | ymid = f(xmid)
19 | ywidth = (amax - amin)*xhalf
20 | ywidth_half = ywidth*0.5
21 |
22 | ycenter_left = ymid - xhalf*amid
23 | ycenter_right = ymid + xhalf*amid
24 |
25 | Shape{
26 | polygon: [
27 | Vec2(xmin, ycenter_left + ywidth_half)
28 | Vec2(xmax, ycenter_right + ywidth_half)
29 | Vec2(xmax, ycenter_right - ywidth_half)
30 | Vec2(xmin, ycenter_left - ywidth_half)
31 | ]
32 | ls: [
33 | {
34 | line: [Vec2(xmid - xhalf, ymid - xhalf*amin), Vec2(xmid + xhalf, ymid + xhalf*amin)]
35 | stroke: Rgb(0, 255, 255)
36 | }
37 | {
38 | line: [Vec2(xmid - xhalf, ymid - xhalf*amax), Vec2(xmid + xhalf, ymid + xhalf*amax)]
39 | stroke: Rgb(0, 255, 0)
40 | }
41 | ]
42 | }
43 | )
44 |
45 | route = Shape{
46 | begin = 0
47 | end = 90
48 | b: FunctionPath(Sin, begin, end, 100){
49 | stroke: Rgb(255, 0, 0)
50 | }
51 | a: getParallelotope(Sin, Cos, begin, end){
52 | fill: Rgb(64, 64, 64)
53 | }
54 | scale: {x:200, y:-100}
55 | }
56 |
--------------------------------------------------------------------------------
/examples/path8.cgl:
--------------------------------------------------------------------------------
1 | import "koch_curve.cgl" as koch_curve
2 |
3 | arcPath = (r, begin, end, num ->
4 | {
5 | delta = 1.0*(end - begin)/num
6 | line: for i in 0:num list(
7 | angle = begin + delta*i
8 | Vec2(r*Cos(angle), r*Sin(angle))
9 | )
10 | })
11 |
12 | main = Shape{
13 | rect = Square{scale = {x: 60, y: 30}, pos = {x: 100, y: 100}, angle = 30}
14 | tri = hexagon{scale = {x:100, y:100}}
15 |
16 | koch_shape = koch_curve.curve(5)
17 | arrow3= FunctionPath(Sin, 180, 360, 100){
18 | scale: {x: 200, y:100}
19 | stroke: {r: 255, g: 128, b: 128}
20 | }
21 | arc1 = arcPath(300, 0, 120, 10)
22 | arc2 = arcPath(300, 120, 240, 10)
23 | arc3 = arcPath(300, 240, 360, 10)
24 | result1: Shape{
25 | a:DeformShapeByPath(koch_shape, arc1)
26 | stroke: {r: 0, g: 128, b: 128}
27 | }
28 | result2: Shape{
29 | a:DeformShapeByPath(koch_shape, arc2)
30 | stroke: {r: 0, g: 128, b: 128}
31 | }
32 | result3: Shape{
33 | a:DeformShapeByPath(koch_shape, arc3)
34 | stroke: {r: 0, g: 128, b: 128}
35 | }
36 | result4: arcPath(260, 0, 360, 50){
37 | stroke: {r: 0, g: 128, b: 128}
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/examples/pita_constraint_example.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 |
4 | fontPath = "C:/Users/dphs1/AppData/Roaming/Adobe/CoreSync/plugins/livetype/r/35668"
5 | fontTitle = "C:/Users/dphs1/AppData/Roaming/Adobe/CoreSync/plugins/livetype/r/34828"
6 |
7 | main = Shape{
8 | cubes: for i in 0:2 list(r = 30+10*i, Square{scale: X2(r)})
9 | sat( Contact(cubes[0].topRight(), cubes[1].bottomLeft()) )
10 | sat( Contact(cubes[1].bottomRight(), cubes[2].topRight()) )
11 | sat( Contact(cubes[2].topLeft(), cubes[0].bottomRight()) )
12 | var(cubes[[1, 2]].pos, cubes[[1, 2]].angle)
13 | fill: Rgb(49, 187, 222)
14 | }
15 |
--------------------------------------------------------------------------------
/examples/pita_inclusion.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 |
4 | main = Shape{
5 | a: Shape{a: Buffer(Square{scale: Vec2(200, 100)}, 30), fill: mainColor}
6 | b: Circle(100){scale: X2(60), pos: Vec2(40, 40), fill: baseColor}
7 | }
--------------------------------------------------------------------------------
/examples/pita_koch_example.cgl:
--------------------------------------------------------------------------------
1 | koch = (p, q ->
2 | v = Sub(p, q)
3 | n = {x: -v.y, y: v.x}
4 | ps = [p
5 | Lerp(p, q, 1.0/3.0)
6 | Add(Mid(p, q), Div(n, 2*3.0^0.5))
7 | Lerp(p, q, 2.0/3.0)
8 | q]
9 | for i in 0:3 list([ps[i], ps[i+1]])
10 | )
11 |
12 | rec = (f, depth, template, ps ->
13 | if depth == 0
14 | then { line: ps }
15 | else {
16 | ss = template(ps[0], ps[1])
17 | b: for i in 0:3 list( f(f, depth-1, template, ss[i]) )
18 | }
19 | )
20 |
21 | snowflake = Shape{
22 | tri = Triangle{scale: X2(10)}
23 | l: for i in 0:2 list(
24 | rec(rec, 5, koch, [tri.p(i), tri.p(Mod(i+1,3))])
25 | )
26 | scale: X2(70)
27 | stroke: Rgb(49, 187, 222)
28 | }
29 |
--------------------------------------------------------------------------------
/examples/pita_log_averageOfAspectRatio:
--------------------------------------------------------------------------------
1 | [
2 | [3, 1104.26]
3 | [4, 1081.53]
4 | [5, 4245]
5 | [6, 2424.87]
6 | [7, 5330.07]
7 | [8, 3137.26]
8 | [9, 4807.47]
9 | [10, 4576.47]
10 | [11, 9801.51]
11 | [12, 6147.11]
12 | [13, 12251.4]
13 | [14, 7437.24]
14 | [15, 14797]
15 | [16, 8701.15]
16 | [17, 17644.4]
17 | [18, 10147.3]
18 | [19, 20458.6]
19 | [20, 11581.2]
20 | [21, 22742.7]
21 | [22, 13024.3]
22 | [23, 24248.4]
23 | [24, 14554.6]
24 | [25, 24631.7]
25 | [26, 15999.4]
26 | [27, 28232.5]
27 | [28, 17513.3]
28 | [29, 29968]
29 | [30, 19061.4]
30 | [31, 32643.3]
31 | [32, 20553.4]
32 | [33, 34916.7]
33 | [34, 21981.3]
34 | [35, 36834.8]
35 | [36, 23614.4]
36 | [37, 40501.5]
37 | [38, 24956.6]
38 | [39, 41569.8]
39 | [40, 26423.2]
40 | [41, 44672.4]
41 | [42, 28183.9]
42 | [43, 47588.1]
43 | [44, 29688]
44 | [45, 50311.3]
45 | [46, 31650.3]
46 | [47, 52795.4]
47 | [48, 33862.7]
48 | [49, 55070.1]
49 | [50, 35993]
50 | [51, 61696.3]
51 | [52, 37683.3]
52 | [53, 62979.3]
53 | [54, 38887.3]
54 | [55, 64632.5]
55 | [56, 41030]
56 | [57, 71755.2]
57 | [58, 42561.4]
58 | [59, 71836]
59 | [60, 44353.3]
60 | [61, 72684.9]
61 | [62, 46079.4]
62 | [63, 79377.4]
63 | [64, 47755.1]
64 | [65, 78882.6]
65 | [66, 49508.6]
66 | [67, 84782.9]
67 | [68, 51392.5]
68 | [69, 91147.5]
69 | [70, 53271.9]
70 | [71, 90898.1]
71 | [72, 54507]
72 | [73, 100092]
73 | [74, 56616.5]
74 | [75, 93621.8]
75 | [76, 58568.1]
76 | [77, 101332]
77 | [78, 60883.3]
78 | [79, 109343]
79 | [80, 62281.3]
80 | [81, 110170]
81 | [82, 64638.2]
82 | [83, 107740]
83 | [84, 66159.3]
84 | [85, 113266]
85 | [86, 68119.7]
86 | [87, 119618]
87 | [88, 69289.9]
88 | [89, 109177]
89 | [90, 71720.7]
90 | [91, 115163]
91 | [92, 73136.1]
92 | [93, 119962]
93 | [94, 75864.3]
94 | [95, 121477]
95 | [96, 77189.2]
96 | [97, 131773]
97 | [98, 78871.8]
98 | [99, 113585]
99 | ]
100 |
--------------------------------------------------------------------------------
/examples/pita_log_divisionNum:
--------------------------------------------------------------------------------
1 | [
2 | [3, 3]
3 | [4, 4]
4 | [5, 5]
5 | [6, 6]
6 | [7, 7]
7 | [8, 8]
8 | [9, 9]
9 | [10, 10]
10 | [11, 11]
11 | [12, 12]
12 | [13, 13]
13 | [14, 14]
14 | [15, 15]
15 | [16, 16]
16 | [17, 17]
17 | [18, 18]
18 | [19, 19]
19 | [20, 20]
20 | [21, 21]
21 | [22, 22]
22 | [23, 23]
23 | [24, 24]
24 | [25, 25]
25 | [26, 26]
26 | [27, 27]
27 | [28, 28]
28 | [29, 29]
29 | [30, 30]
30 | [31, 31]
31 | [32, 32]
32 | [33, 33]
33 | [34, 34]
34 | [35, 35]
35 | [36, 36]
36 | [37, 37]
37 | [38, 38]
38 | [39, 39]
39 | [40, 40]
40 | [41, 41]
41 | [42, 42]
42 | [43, 43]
43 | [44, 44]
44 | [45, 45]
45 | [46, 46]
46 | [47, 47]
47 | [48, 48]
48 | [49, 49]
49 | [50, 50]
50 | [51, 51]
51 | [52, 52]
52 | [53, 53]
53 | [54, 54]
54 | [55, 55]
55 | [56, 56]
56 | [57, 57]
57 | [58, 58]
58 | [59, 59]
59 | [60, 60]
60 | [61, 61]
61 | [62, 62]
62 | [63, 63]
63 | [64, 64]
64 | [65, 65]
65 | [66, 66]
66 | [67, 67]
67 | [68, 68]
68 | [69, 69]
69 | [70, 70]
70 | [71, 71]
71 | [72, 72]
72 | [73, 73]
73 | [74, 74]
74 | [75, 75]
75 | [76, 76]
76 | [77, 77]
77 | [78, 78]
78 | [79, 79]
79 | [80, 80]
80 | [81, 81]
81 | [82, 82]
82 | [83, 83]
83 | [84, 84]
84 | [85, 85]
85 | [86, 86]
86 | [87, 87]
87 | [88, 88]
88 | [89, 89]
89 | [90, 90]
90 | [91, 91]
91 | [92, 92]
92 | [93, 93]
93 | [94, 94]
94 | [95, 95]
95 | [96, 96]
96 | [97, 97]
97 | [98, 98]
98 | [99, 99]
99 | ]
100 |
--------------------------------------------------------------------------------
/examples/pita_log_sumOfAspectRatio:
--------------------------------------------------------------------------------
1 | [
2 | [3, 3312.79]
3 | [4, 4326.13]
4 | [5, 21225]
5 | [6, 14549.2]
6 | [7, 37310.5]
7 | [8, 25098.1]
8 | [9, 43267.2]
9 | [10, 45764.7]
10 | [11, 107817]
11 | [12, 73765.3]
12 | [13, 159268]
13 | [14, 104121]
14 | [15, 221954]
15 | [16, 139218]
16 | [17, 299955]
17 | [18, 182651]
18 | [19, 388713]
19 | [20, 231624]
20 | [21, 477597]
21 | [22, 286534]
22 | [23, 557713]
23 | [24, 349312]
24 | [25, 615792]
25 | [26, 415984]
26 | [27, 762278]
27 | [28, 490372]
28 | [29, 869072]
29 | [30, 571843]
30 | [31, 1.01194e+06]
31 | [32, 657709]
32 | [33, 1.15225e+06]
33 | [34, 747366]
34 | [35, 1.28922e+06]
35 | [36, 850117]
36 | [37, 1.49855e+06]
37 | [38, 948350]
38 | [39, 1.62122e+06]
39 | [40, 1.05693e+06]
40 | [41, 1.83157e+06]
41 | [42, 1.18372e+06]
42 | [43, 2.04629e+06]
43 | [44, 1.30627e+06]
44 | [45, 2.26401e+06]
45 | [46, 1.45591e+06]
46 | [47, 2.48138e+06]
47 | [48, 1.62541e+06]
48 | [49, 2.69844e+06]
49 | [50, 1.79965e+06]
50 | [51, 3.14651e+06]
51 | [52, 1.95953e+06]
52 | [53, 3.3379e+06]
53 | [54, 2.09992e+06]
54 | [55, 3.55479e+06]
55 | [56, 2.29768e+06]
56 | [57, 4.09005e+06]
57 | [58, 2.46856e+06]
58 | [59, 4.23832e+06]
59 | [60, 2.6612e+06]
60 | [61, 4.43378e+06]
61 | [62, 2.85693e+06]
62 | [63, 5.00078e+06]
63 | [64, 3.05632e+06]
64 | [65, 5.12737e+06]
65 | [66, 3.26757e+06]
66 | [67, 5.68045e+06]
67 | [68, 3.49469e+06]
68 | [69, 6.28918e+06]
69 | [70, 3.72903e+06]
70 | [71, 6.45377e+06]
71 | [72, 3.9245e+06]
72 | [73, 7.30672e+06]
73 | [74, 4.18962e+06]
74 | [75, 7.02163e+06]
75 | [76, 4.45117e+06]
76 | [77, 7.80255e+06]
77 | [78, 4.74889e+06]
78 | [79, 8.63808e+06]
79 | [80, 4.98251e+06]
80 | [81, 8.92377e+06]
81 | [82, 5.30033e+06]
82 | [83, 8.94241e+06]
83 | [84, 5.55738e+06]
84 | [85, 9.62763e+06]
85 | [86, 5.8583e+06]
86 | [87, 1.04068e+07]
87 | [88, 6.09751e+06]
88 | [89, 9.71672e+06]
89 | [90, 6.45486e+06]
90 | [91, 1.04798e+07]
91 | [92, 6.72852e+06]
92 | [93, 1.11564e+07]
93 | [94, 7.13124e+06]
94 | [95, 1.15403e+07]
95 | [96, 7.41016e+06]
96 | [97, 1.27819e+07]
97 | [98, 7.72944e+06]
98 | [99, 1.12449e+07]
99 | ]
100 |
--------------------------------------------------------------------------------
/examples/pita_log_sumOfPerimeter:
--------------------------------------------------------------------------------
1 | [
2 | [3, 0.695471]
3 | [4, 0.695276]
4 | [5, 0.695232]
5 | [6, 0.69516]
6 | [7, 0.695052]
7 | [8, 0.695003]
8 | [9, 0.694962]
9 | [10, 0.694949]
10 | [11, 0.694923]
11 | [12, 0.694907]
12 | [13, 0.694884]
13 | [14, 0.694868]
14 | [15, 0.694856]
15 | [16, 0.694842]
16 | [17, 0.694833]
17 | [18, 0.694825]
18 | [19, 0.694815]
19 | [20, 0.694808]
20 | [21, 0.694801]
21 | [22, 0.694795]
22 | [23, 0.69479]
23 | [24, 0.694786]
24 | [25, 0.69478]
25 | [26, 0.694775]
26 | [27, 0.694771]
27 | [28, 0.694767]
28 | [29, 0.694764]
29 | [30, 0.694762]
30 | [31, 0.694758]
31 | [32, 0.694755]
32 | [33, 0.694753]
33 | [34, 0.69475]
34 | [35, 0.694748]
35 | [36, 0.694746]
36 | [37, 0.694743]
37 | [38, 0.694741]
38 | [39, 0.694739]
39 | [40, 0.694737]
40 | [41, 0.694736]
41 | [42, 0.694734]
42 | [43, 0.694733]
43 | [44, 0.694731]
44 | [45, 0.69473]
45 | [46, 0.694729]
46 | [47, 0.694727]
47 | [48, 0.694726]
48 | [49, 0.694725]
49 | [50, 0.694724]
50 | [51, 0.694723]
51 | [52, 0.694721]
52 | [53, 0.69472]
53 | [54, 0.69472]
54 | [55, 0.694719]
55 | [56, 0.694718]
56 | [57, 0.694717]
57 | [58, 0.694716]
58 | [59, 0.694715]
59 | [60, 0.694714]
60 | [61, 0.694714]
61 | [62, 0.694713]
62 | [63, 0.694712]
63 | [64, 0.694711]
64 | [65, 0.694711]
65 | [66, 0.69471]
66 | [67, 0.694709]
67 | [68, 0.694709]
68 | [69, 0.694706]
69 | [70, 0.694708]
70 | [71, 0.694707]
71 | [72, 0.694707]
72 | [73, 0.694705]
73 | [74, 0.694706]
74 | [75, 0.694705]
75 | [76, 0.694704]
76 | [77, 0.694703]
77 | [78, 0.694704]
78 | [79, 0.694703]
79 | [80, 0.694703]
80 | [81, 0.694702]
81 | [82, 0.694702]
82 | [83, 0.694702]
83 | [84, 0.694699]
84 | [85, 0.694701]
85 | [86, 0.6947]
86 | [87, 0.6947]
87 | [88, 0.694699]
88 | [89, 0.694699]
89 | [90, 0.694699]
90 | [91, 0.694699]
91 | [92, 0.694698]
92 | [93, 0.694698]
93 | [94, 0.694697]
94 | [95, 0.694696]
95 | [96, 0.694697]
96 | [97, 0.694697]
97 | [98, 0.694696]
98 | [99, 0.694696]
99 | ]
100 |
--------------------------------------------------------------------------------
/examples/pita_logo__.cgl:
--------------------------------------------------------------------------------
1 | /*
2 | arc = (quality, beginAngle, endAngle -> Shape{
3 | r = 0.5
4 | polygon: [
5 | Vec2(0, 0)
6 | Vec2(r*Cos(beginAngle), r*Sin(beginAngle))
7 | Vec2(r*Cos(endAngle), r*Sin(endAngle))
8 | ]
9 | delta = (endAngle - beginAngle) / quality
10 | polygon: for i in 0:quality list(
11 | angle = beginAngle + delta*i
12 | Vec2(r*Cos(angle), r*Sin(angle))
13 | )
14 | })
15 | */
16 |
17 |
18 | arc = (quality, beginAngle, endAngle -> Shape{
19 | r = 0.5
20 | delta = 1.0*(endAngle - beginAngle) / quality
21 | polygon: for i in 0:quality list(
22 | currentAngle = beginAngle + delta*i
23 | Vec2(r*Cos(currentAngle), r*Sin(currentAngle))
24 | )
25 | polygon = [Vec2(0, 0)] @ polygon
26 | })
27 |
28 | width = 20
29 |
30 | base_circle = (s = Circle(100), s{scale: X2(500)})
31 | arc_scope = (s = arc(100, 30.0, -30.0), s{scale: X2(500)})
32 |
33 | text_p_ = Shape{
34 | p_bar = Shape{
35 | ring = Diff(base_circle, Buffer(base_circle, -width))
36 | result: Intersect(ring, arc_scope)
37 | }
38 | p_ring = Shape{
39 | height = 120
40 | a = Square{scale: Vec2(150, height)}
41 | b = (s = Circle(100), s{scale: X2(height), pos: Right(a)})
42 | c = a{scale.y = scale.y - width*2}
43 | d = b{scale = Sub(scale, X2(width*2))}
44 | res: Diff(Union(a, b), Union(c, d))
45 | }
46 | bar: p_bar
47 | ring: p_ring
48 | sat(Contact(TopLeft(ring), Top(bar)))
49 | var(ring.pos)
50 | }
51 |
52 | text_p = Shape{
53 | bar: text_p_.bar
54 | ring: Diff(text_p_.ring, arc_scope{scale = Mul(scale, 0.99) })
55 | fill: Rgb(200,200,200)
56 | }
57 |
58 | main = Shape{
59 | a: [
60 | Shape{
61 | s: [
62 | Intersect(base_circle, Shape{polygon:[Top(base_circle), TopRight(base_circle), BottomRight(base_circle), Bottom(base_circle)]})
63 | arc_scope
64 | ]
65 | fill: Rgb(255,255,255)
66 | stroke: Rgb(0,0,0)
67 | }
68 | ]
69 | b: [
70 | text_p{}
71 | (s = Circle(100), s{scale: X2(300), pos: Vec2(600, 0)})
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/examples/pita_p1.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 | accentColor = Rgb(68, 84, 106)
4 |
5 | gear = (gearNum -> Shape{
6 | baseCircle = Circle(100)
7 | outerCircle = baseCircle{scale: X2(100)}
8 | innerCircle = baseCircle{scale: X2(50)}
9 | gearShape = hexagon{scale: Vec2(10,25)}
10 | delta = 0.5 / gearNum
11 | gears = for i in 1:gearNum list(
12 | DeformShapeByPath2(gearShape,
13 | SubPath(ShapeOuterPath(outerCircle)[0], delta*(i*2), delta*(i*2+1.2)),
14 | gearShape.p(3), gearShape.p(0))
15 | )
16 | gear: Shape{s: Diff(Union(outerCircle, gears), innerCircle)}
17 | })
18 |
19 | main = {
20 | a: gear(7)
21 | b: a{pos: Vec2(100,100)}
22 | sat( Area(Intersect(a, b))^2 + Area(BoundingBox({s:[a,b]}))*0.01 )
23 | var(b.pos)
24 | }
25 | main2 = {
26 | a: main
27 | b: main.a{pos: Vec2(200,300)}
28 | fill: accentColor
29 | sat( Area(Intersect(a, b))^2 + Area(BoundingBox({s:[a,b]}))*0.01 )
30 | var(b.pos)
31 | }
--------------------------------------------------------------------------------
/examples/pita_p1_.cgl:
--------------------------------------------------------------------------------
1 | gear = (gearNum -> Shape{
2 | outerCircle = Circle{scale: X2(100)}
3 | innerCircle = Circle{scale: X2(50)}
4 | gearShape = Hexagon{scale: Vec2(10,25)}
5 | delta = 0.5 / gearNum
6 | gears = for i in 1:gearNum list(
7 | Print(ShapeOuterPath(outerCircle).line[0])
8 | DeformShapeByPath2(gearShape,
9 | SubPath(ShapeOuterPath(outerCircle), delta*(i*2), delta*(i*2+1.2)),
10 | gearShape.p(3), gearShape.p(0))
11 | )
12 | gear: Shape{s: Diff(Union(outerCircle, gears), innerCircle)}
13 | })
14 |
15 | main = Shape{
16 | a: gear(7)
17 | b: a{pos: Vec2(100,100)}
18 | c: a{pos: Vec2(200,300)}
19 | fill: Rgb(68, 84, 106)
20 | sat( Area(Intersect(a, b))^2 + Area(Intersect(b, c))^2 +
21 | Area(BoundingBox({s:[a,b]}))*0.01 + Area(BoundingBox({s:[b,c]}))*0.01 )
22 | var(b.pos, c.pos)
23 | }
24 |
--------------------------------------------------------------------------------
/examples/pita_p2.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 | accentColor = Rgb(68, 84, 106)
4 |
5 | arrow = Shape{
6 | body: Square{scale: Vec2(400, 20), pos: Vec2(-200, 0)}
7 | head: Triangle{scale: X2(50), pos: X2(0), angle: 90}
8 | }
9 |
10 | main = Shape{
11 | a: Square{scale: X2(100), angle: 45}
12 | b: a{pos: Vec2(300, 0)}
13 | strength = 5.0
14 | c = BezierPath(
15 | a.bottom(), Mul(Sub(a.bottom(), a.top()), strength),
16 | b.right(), Mul(Sub(b.right(), b.left()), strength),
17 | 100)
18 | fill: baseColor
19 | stroke: accentColor
20 |
21 | arrowShape = arrow{}
22 | d: DeformShapeByPath2({s:SubDiv(arrowShape, 10)},
23 | c.result,
24 | arrowShape.body.left(), arrowShape.head.top())
25 | }
26 |
--------------------------------------------------------------------------------
/examples/pita_p3.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 | accentColor = Rgb(68, 84, 106)
4 |
5 | kite = Shape{
6 | polygon: [
7 | {x: 0, y: 0}, {x: 15, y: -2.5}, {x: 30, y: 0}, {x: 15, y: +2.5}
8 | ]
9 | begin: (->Transform(@pos, @scale, @angle, polygon[0]))
10 | end: (->Transform(@pos, @scale, @angle, polygon[2]))
11 | }
12 |
13 | skeleton = (num -> Shape{
14 | ss: []
15 | for i in 0:num-1 do(
16 | newKite = kite{pos.x = 100*i}
17 | ss = ss @ [newKite]
18 | var(newKite.pos, newKite.angle)
19 | )
20 | for i in 0:num-2 do(
21 | sat( Contact(ss[i].end(), ss[i+1].begin()) )
22 | )
23 | begin: (->Transform(@pos, @scale, @angle, ss[0].begin()))
24 | end: (->Transform(@pos, @scale, @angle, ss[num-1].end()))
25 | })
26 |
27 | main = {
28 | xmax = 300.0
29 |
30 | rect = Square{scale: Vec2(50, 20), pos: Vec2(0, -50)}
31 | rectL: rect{sat(left().x == 0), var(pos.x)}
32 | rectR: rect{sat(right().x == xmax), var(pos.x)}
33 |
34 | pole = Square{scale: Vec2(3, 20), fill: mainColor}
35 | poleL: pole{sat( Contact(Lerp(rectL.top(), rectL.topRight(), 0.7), bottom()) ), var(pos)}
36 | poleR: pole{sat( Contact(Lerp(rectR.top(), rectR.topLeft(), 0.7), bottom()) ), var(pos)}
37 |
38 | rail: Shape{
39 | polygon: [poleL.top(), poleR.top(), Moved(poleR.top(), 0, 1), Moved(poleL.top(), 0, 1)]
40 | fill: mainColor
41 | stroke_width: 0
42 | center: (->globalPos(Mid(polygon[0], polygon[1])))
43 | }
44 |
45 | sinPath = FunctionPath(Sin, 0, 1440, 500){ scale: Vec2(xmax/1440.0, 10) }
46 | ocean: Shape{
47 | polygon: sinPath.line @ [Vec2(1440, 5), Vec2(0, 5)]
48 | scale: sinPath.scale
49 | fill: mainColor
50 | }
51 |
52 | bridge: skeleton(7){
53 | pos: Vec2(xmax*0.5 - (end().x + begin().x)*0.5, 0)
54 | sat( Contact(begin(), rectL.topRight()) )
55 | sat( Contact(end(), rectR.topLeft()) )
56 | }
57 |
58 | fill: baseColor
59 | stroke: mainColor
60 | stroke_width: 0.5
61 | }
--------------------------------------------------------------------------------
/examples/pita_p3__.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 | accentColor = Rgb(68, 84, 106)
4 |
5 | kite = Shape{
6 | polygon: [
7 | {x: 0, y: 0}, {x: 15, y: -2.5}, {x: 30, y: 0}, {x: 15, y: +2.5}
8 | ]
9 | begin: (->Transform(@pos, @scale, @angle, polygon[0]))
10 | end: (->Transform(@pos, @scale, @angle, polygon[2]))
11 | }
12 |
13 | skeleton = (num -> Shape{
14 | ss: []
15 | for i in 0:num-1 do(
16 | newKite = kite{pos.x = 100*i}
17 | ss = ss @ [newKite]
18 | var(newKite.pos, newKite.angle)
19 | )
20 | for i in 0:num-2 do(
21 | sat( Contact(ss[i].end(), ss[i+1].begin()) )
22 | )
23 | begin: (->Transform(@pos, @scale, @angle, ss[0].begin()))
24 | end: (->Transform(@pos, @scale, @angle, ss[num-1].end()))
25 | center: (->Transform(@pos, @scale, @angle, ss[3].end()))
26 | })
27 |
28 | main = {
29 | xmax = 300.0
30 |
31 | rect = Square{scale: Vec2(50, 20), pos: Vec2(0, -50)}
32 | rectL: rect{sat(left().x == 0), var(pos.x)}
33 | rectR: rect{sat(right().x == xmax), var(pos.x)}
34 |
35 | pole = Square{scale: Vec2(3, 20), fill: mainColor}
36 | poleL: pole{sat( Contact(Lerp(rectL.top(), rectL.topRight(), 0.7), bottom()) ), var(pos)}
37 | poleR: pole{sat( Contact(Lerp(rectR.top(), rectR.topLeft(), 0.7), bottom()) ), var(pos)}
38 |
39 | rail: Shape{
40 | polygon: [poleL.top(), poleR.top(), Moved(poleR.top(), 0, 1), Moved(poleL.top(), 0, 1)]
41 | fill: mainColor
42 | stroke_width: 0
43 | center: (->globalPos(Mid(polygon[0], polygon[1])))
44 | }
45 |
46 | sinPath = FunctionPath(Sin, 0, 1440, 500){ scale: Vec2(xmax/1440.0, 10) }
47 | ocean: Shape{
48 | polygon: sinPath.line @ [Vec2(1440, 5), Vec2(0, 5)]
49 | scale: sinPath.scale
50 | fill: mainColor
51 | }
52 |
53 | bridge: skeleton(7){
54 | pos: Vec2(xmax*0.5 - (end().x + begin().x)*0.5, 0)
55 | sat( Contact(begin(), rectL.topRight()) )
56 | sat( Contact(end(), rectR.topLeft()) )
57 | sat( Distance(center(), rail) == 0.0 )
58 | }
59 |
60 | fill: baseColor
61 | stroke: mainColor
62 | stroke_width: 0.5
63 | }
--------------------------------------------------------------------------------
/examples/pita_procedural_example.cgl:
--------------------------------------------------------------------------------
1 | arrow = Shape{
2 | body: Square{scale: Vec2(200, 20), pos: Vec2(-100, 0)}
3 | head: Triangle{scale: X2(50), pos: X2(0), angle: 90}
4 | }
5 |
6 | arcPath = (r, begin, end, num ->
7 | {
8 | delta = 1.0*(end - begin)/num
9 | line: for i in 0:num list(
10 | angle = begin + delta*i
11 | Vec2(r*Cos(angle), r*Sin(angle))
12 | )
13 | })
14 |
15 | recycle = Shape{
16 | a = arrow{}
17 | arrows: for i in 0:2 list(
18 | DeformShapeByPath2(a,
19 | arcPath(100, 120*i, 120*(i+1), 50),
20 | a.body.left(), a.head.top())
21 | )
22 | fill: Rgb(0, 162, 232)
23 | }
24 |
--------------------------------------------------------------------------------
/examples/pita_shape_inheritance.cgl:
--------------------------------------------------------------------------------
1 | Triangle{
2 | scale: {x: 200, y: 100}
3 | fill: Rgb(49, 187, 222)
4 | }
5 |
6 | Square{
7 | scale: {x: 100, y: 100}
8 | angle: 45
9 | fill: Rgb(49, 187, 222)
10 | }
11 |
12 | arrow = Shape{
13 | head: Triangle{scale: {x: 100, y: 100}, pos: {x: 0, y: -75}}
14 | body: Square{scale: {x: 50, y: 100}}
15 | angle: 90
16 | fill: Rgb(49, 187, 222)
17 | }
18 |
--------------------------------------------------------------------------------
/examples/pita_skeleton.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 |
4 | kite = Shape{
5 | polygon: [
6 | {x: 0, y: 0}, {x: 20, y: -20}, {x: 80, y: 0}, {x: 20, y: +20}
7 | ]
8 | begin: (->Transform(@pos, @scale, @angle, polygon[0]))
9 | end: (->Transform(@pos, @scale, @angle, polygon[2]))
10 | }
11 |
12 | skeleton = (num -> Shape{
13 | ss: []
14 | for i in 0:num-1 do(
15 | newKite = kite{pos.x = 100*i}
16 | ss = ss @ [newKite]
17 | var(newKite.pos, newKite.angle)
18 | )
19 | for i in 0:num-2 do(
20 | sat( Contact(ss[i].end(), ss[i+1].begin()) )
21 | )
22 | begin: (->Transform(@pos, @scale, @angle, ss[0].begin()))
23 | end: (->Transform(@pos, @scale, @angle, ss[num-1].end()))
24 | })
25 |
26 | skeletonA = skeleton(5)
27 |
28 | main = skeletonA{
29 | sat( Contact(begin(), {x: 30, y:200}) )
30 | sat( Contact(end(), {x: 200, y:150}) )
31 | fill: mainColor
32 | }
--------------------------------------------------------------------------------
/examples/pita_source_code.cgl:
--------------------------------------------------------------------------------
1 | baseColor = Rgb(245, 245, 245)
2 | mainColor = Rgb(49, 187, 222)
3 |
4 | fontPath = "C:/Users/dphs1/AppData/Roaming/Adobe/CoreSync/plugins/livetype/r/35668"
5 | sourceFontPath = "C:/Windows/Fonts/SourceCodePro-Regular.ttf"
6 |
7 | sourceCodeText =
8 | "{
9 | size = 100
10 | polygon: [
11 | {x: 0, y: 0}, {x: size, y: 0}
12 | {x: size, y: size}, {x: 0, y: size}
13 | ]
14 | fill: {r: 49, g: 187, b: 222}
15 | }"
16 |
17 | sourceCodeShape = {
18 | a: BuildText(sourceCode, {}, sourceFontPath)
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/examples/pita_syntax_basic.cgl:
--------------------------------------------------------------------------------
1 | {
2 | size = 100
3 | polygon: [
4 | Vec2(0, 0)
5 | Vec2(size, 0)
6 | Vec2(size, size)
7 | Vec2(0, size)
8 | ]
9 | fill: Rgb(49, 187, 222)
10 | }
--------------------------------------------------------------------------------
/examples/plot_input.cgl:
--------------------------------------------------------------------------------
1 | {
2 | size: 3
3 | labels: [
4 | "x1"
5 | "x2"
6 | "平均区間幅"
7 | ]
8 | data: [
9 | [166.667, 100, 5, 185.706], [40.6431, 125.251, 96.9179, 331.488], [66.3102, 46.2251, 55.1748, 205.711], [56.5146, 148.932, 99.6497, 326.283], [290.308, 108.876, 98.1299, 215.19], [32.9585, 119.716, 30.4059, 234.34], [1.43505, 16.8697, 64.3366, 341.562], [263.529, 75.5494, 79.9949, 170.087], [108.388, 31.7886, 68.4546, 181.278], [119.622, 111.097, 48.0011, 136.065], [126.626, 26.0798, 30.8894, 178.626], [239.184, 47.4826, 87.3705, 163.152], [44.7342, 149.11, 82.3684, 316.67], [37.5548, 114.563, 49.5683, 232.756], [199.082, 18.8845, 21.8107, 124.199], [15.3649, 5.46619, 41.4644, 373.474], [137.397, 73.1353, 79.6035, 157.589], [276.262, 121.13, 70.8717, 218.75], [0.84553, 106.606, 64.7521, 206.373], [136.81, 116.088, 57.8017, 119.148], [263.027, 121.226, 2.75962, 174.235], [246.374, 123.126, 94.0673, 229.316], [123.8, 63.4748, 58.5147, 184.248], [47.4173, 114.26, 23.7855, 226.071], [242.92, 148.278, 33.9124, 190.728], [89.9495, 2.03087, 22.5065, 288.688], [272.209, 127.27, 95.5467, 248.09], [233.669, 148.119, 7.69194, 191.86]
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/examples/rec1.cgl:
--------------------------------------------------------------------------------
1 | func1 = (n -> if n<=0 then 0 else 1 + func2(n - 1))
2 | func2 = (n -> if n<=0 then 0 else 2 + func1(n - 1))
3 |
4 | func1\_1 = (n -> 1)
5 | func2\_2 = (n -> 1)
6 |
7 | /*
8 | {
9 | a = func(10)
10 | Print(a)
11 | }
12 | */
13 |
14 | a = func1(10)
15 | Print(a)
--------------------------------------------------------------------------------
/examples/rec2.cgl:
--------------------------------------------------------------------------------
1 | x = (x^2 - y^2 + 0.377)
2 | y = (2*x*y + 0.2)
3 |
4 | x\_200 = 0
5 | y\_200 = 0
6 |
7 | Print([x, y])
8 |
--------------------------------------------------------------------------------
/examples/rec3.cgl:
--------------------------------------------------------------------------------
1 | A\_10 = Square{scale: X2(100)}
2 |
3 | A = Shape{
4 | a: Square{scale: X2(100)}
5 | b: A{scale: X2(0.9), pos: Vec2(100, 0), angle: 30}
6 | }
7 |
8 | A{}
9 |
--------------------------------------------------------------------------------
/examples/rec4.cgl:
--------------------------------------------------------------------------------
1 | A\_2 = {}
2 | B\_2 = {}
3 |
4 | A = Shape{
5 | //s: Triangle{scale: X2(100), angle: 90}
6 | //a: A{scale: X2(0.9), pos: Vec2(200, 0), angle: 0}
7 | b: B{}
8 | //b2: B{scale: X2(0.9), pos: Angle(-30, 100), angle: 10}
9 | //fill: Rgb(128,128,0)
10 | }
11 |
12 | B = Shape{
13 | s: Triangle{scale: X2(100)}
14 | t: A{}
15 | //fill: Rgb(0,128,128)
16 | }
17 |
18 |
19 | A{}
20 |
--------------------------------------------------------------------------------
/examples/rec5.cgl:
--------------------------------------------------------------------------------
1 | {
2 | res = {
3 | a: Print(A{})
4 | }
5 | }
6 |
7 | A\_2 = {}
8 | B\_2 = {}
9 |
10 | A = Shape{
11 | //s: Triangle{scale: X2(100), angle: 90}
12 | //a: A{scale: X2(0.9), pos: Vec2(200, 0), angle: 0}
13 | b: B{}
14 | //b2: B{scale: X2(0.9), pos: Angle(-30, 100), angle: 10}
15 | //fill: Rgb(128,128,0)
16 | }
17 |
18 | B = Shape{
19 | s: Triangle{scale: X2(100)}
20 | t: A{}
21 | //fill: Rgb(0,128,128)
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/examples/rec_acc.cgl:
--------------------------------------------------------------------------------
1 | adder\_5 = (x->{})
2 |
3 | adder = (x->{
4 | b: adder(x+1){Print(x)}
5 | })
6 |
7 | adder(0)
--------------------------------------------------------------------------------
/examples/rec_shape1.cgl:
--------------------------------------------------------------------------------
1 | shapeList = (f, depth ->
2 | if depth == 0
3 | then Shape{
4 | a: Triangle{}
5 | }
6 | else Shape{
7 | a: Triangle{}
8 | b: (s = f(f, depth-1), s{
9 | pos.y = -1
10 | angle = 15
11 | scale = X2(0.96)
12 | })
13 | }
14 | )
15 |
16 | tree = Shape{
17 | depth = 100
18 | a: (s = shapeList(shapeList, depth), s{scale = X2(60)})
19 | }
20 |
--------------------------------------------------------------------------------
/examples/rec_shape2.cgl:
--------------------------------------------------------------------------------
1 | shapeList = (f, depth, template ->
2 | if depth == 0
3 | then Shape{
4 | a: template{}
5 | }
6 | else Shape{
7 | a: template{}
8 | b: (c = f(f, depth-1, template), c{
9 | pos.y = -1
10 | angle = 30
11 | scale = X2(0.9)
12 | })
13 | }
14 | )
15 |
16 | tree = Shape{
17 | depth = 50
18 | a: (c = shapeList(shapeList, depth, Shape{a:Diff(Triangle{}, Buffer(Triangle{}, -0.1))}), c{scale = X2(100)})
19 | //a.b.b.b.b.b = 0
20 | }
21 |
--------------------------------------------------------------------------------
/examples/rec_shape3.cgl:
--------------------------------------------------------------------------------
1 | shapeTree = (f, depth, template ->
2 | mergin = 4
3 | if depth == 0
4 | then Shape{}
5 | else Shape{
6 | a: template{}
7 | b: if Random(0, 1) < 0.15
8 | then([
9 | (s = f(f, depth-1, template), s{
10 | pos.y = -(template.scale.y + mergin)
11 | angle = 45
12 | })
13 | (s = f(f, depth-1, template), s{
14 | pos.y = -(template.scale.y + mergin)
15 | angle = -45
16 | })
17 | ])
18 | else(
19 | (s = f(f, depth-1, template), s{
20 | pos.y = -(template.scale.y + mergin)
21 | })
22 | )
23 | }
24 | )
25 |
26 | tree = Shape{
27 | depth = 10
28 | templateShape1 = Square{scale = Vec2(1,3)}
29 | templateShape2 = Shape{a: Diff(Triangle{}, Buffer(Triangle{}, -0.1)), scale = Vec2(1,3)}
30 | templateShape3 = Shape{s: Text("樹木"), scale = X2(0.05)}
31 | a: (s = shapeTree(shapeTree, depth, templateShape2{}), s{scale = X2(10)})
32 | }
33 |
--------------------------------------------------------------------------------
/examples/rec_square.cgl:
--------------------------------------------------------------------------------
1 | unitSize = 500.0
2 |
3 | //rects\_2 = Shape{a: Square{scale: X2(unitSize)}}
4 | rects\_3 = (r,g,b->Shape{s: Square{scale: X2(unitSize), fill: Rgb(r,g,b)}})
5 |
6 | rects = (r,g,b -> Shape{
7 | scaleRate = 1.0/3.0
8 | theta = 45
9 | distance = 0.75
10 | c = 110
11 | shapes:[
12 | rects(r+c*1.0,g+c,b){pos: Vec2(-unitSize,-unitSize)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
13 | rects(r+c*0.5,g+c,b){pos: Vec2(0,-unitSize)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
14 | rects(r+c*0.0,g+c,b){pos: Vec2(unitSize,-unitSize)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
15 |
16 | rects(r+c*1.0,g+c*0.5,b){pos: Vec2(-unitSize,0)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
17 | rects(r+c*0.0,g+c*0.5,b){pos: Vec2(unitSize,0)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
18 |
19 | rects(r+c*1.0,g+c*0.0,b){pos: Vec2(-unitSize,+unitSize)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
20 | rects(r+c*0.5,g+c*0.0,b){pos: Vec2(0,+unitSize)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
21 | rects(r+c*0.0,g+c*0.0,b){pos: Vec2(unitSize,+unitSize)*scaleRate*distance, scale:X2(scaleRate), angle: theta}
22 | ]
23 | })
24 |
25 | rects(0,0,200)
--------------------------------------------------------------------------------
/examples/rec_square_.cgl:
--------------------------------------------------------------------------------
1 | unitSize = 500.0
2 |
3 | crossRect = (r,g,b -> Shape{
4 | rate = 1.0/3.0
5 | c = 60
6 | s: for x in -1:1 list(
7 | for y in -1:1 list(
8 | if x != 0 | y != 0
9 | then crossRect(r+c*(1-x),g+c*(1-y),b){
10 | pos: Vec2(x, y)*unitSize*rate/**0.75*/
11 | scale: X2(rate)/*, angle: 45*/}
12 | )
13 | )
14 | })
15 |
16 | crossRect\_3 = (r,g,b -> Shape{s:Square{scale: X2(unitSize), fill: Rgb(r,g,b)}})
17 |
18 | crossRect(0,0,200)
--------------------------------------------------------------------------------
/examples/shapes_prototype.cgl:
--------------------------------------------------------------------------------
1 | main = shapepath{
2 | shapes: [Square{scale: {x: 100, y: 100}}, Square{scale: {x: 200, y: 50}}, Square{scale: {x: 40, y: 70}}]
3 | base: path{
4 | points: 4
5 | passes: [rect.top(), rect.right(), rect.bottom(), rect.left()]
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/skeleton.cgl:
--------------------------------------------------------------------------------
1 | EnableGC(true)
2 |
3 | kite = Shape{
4 | polygon: [
5 | {x: 0, y: 0}, {x: 20, y: -20}, {x: 80, y: 0}, {x: 20, y: +20}
6 | ]
7 | begin: (->Transform(@pos, @scale, @angle, polygon[0]))
8 | end: (->Transform(@pos, @scale, @angle, polygon[2]))
9 | }
10 |
11 | skeleton = (num -> Shape{
12 | ss: []
13 | for i in 0:num-1 do(
14 | newKite = kite{pos.x = 100*i}
15 | ss = ss @ [newKite]
16 | var(ss[i].pos, ss[i].angle)
17 | )
18 | for i in 0:num-2 do(
19 | sat( Contact(ss[i].end(), ss[i+1].begin()) )
20 | )
21 | begin: (->Transform(@pos, @scale, @angle, ss[0].begin()))
22 | end: (->Transform(@pos, @scale, @angle, ss[num-1].end()))
23 | })
24 |
25 | skeletonA = skeleton(7)
26 | //skeletonA = skeleton(5)
27 |
28 | main = skeletonA{
29 | Print(Triangle{})
30 | sat( Contact(begin(), {x: 30, y:200}) )
31 | sat( Contact(end(), {x: 200, y:150}) )
32 | }
33 |
--------------------------------------------------------------------------------
/examples/skeleton2.cgl:
--------------------------------------------------------------------------------
1 | kite = Shape{
2 | polygon: [
3 | {x: 0, y: 0}, {x: 20, y: -20}, {x: 80, y: 0}, {x: 20, y: +20}
4 | ]
5 | begin: (->Transform(@pos, @scale, @angle, polygon[0]))
6 | end: (->Transform(@pos, @scale, @angle, polygon[2]))
7 | }
8 |
9 | skeleton = (num -> Shape{
10 | ss: []
11 | for i in 0:num-1 do(
12 | newKite = kite{pos.x = 100*i}
13 | ss = ss @ [newKite]
14 | var(@ss[i].pos, @ss[i].angle)
15 | )
16 | for i in 0:num-2 do(
17 | sat( Contact(ss[i].end(), ss[i+1].begin()) )
18 | )
19 | begin: (->Transform(@pos, @scale, @angle, ss[0].begin()))
20 | end: (->Transform(@pos, @scale, @angle, ss[num-1].end()))
21 | })
22 |
23 | skeletonA = skeleton(5)
24 |
25 | main = skeletonA{
26 | ss[2] = kite{pos.x = 100, pos.y = 200}
27 | sat( Contact(begin(), {x: 30, y:200}) )
28 | sat( Contact(end(), {x: 200, y:150}) )
29 | }
--------------------------------------------------------------------------------
/examples/skeleton3.cgl:
--------------------------------------------------------------------------------
1 | kite = Shape{
2 | polygon: [
3 | {x: 0, y: 0}, {x: 20, y: -20}, {x: 80, y: 0}, {x: 20, y: +20}
4 | ]
5 | begin: (->Transform(@pos, @scale, @angle, polygon[0]))
6 | end: (->Transform(@pos, @scale, @angle, polygon[2]))
7 | }
8 |
9 | skeleton = (num -> Shape{
10 | ss: []
11 | for i in 0:num-1 do(
12 | newKite = kite{pos.x = 100*i}
13 | ss = ss @ [newKite]
14 | )
15 | var(ss[*].pos, ss[*].angle)
16 | for i in 0:num-2 do(
17 | sat( Contact(ss[i].end(), ss[i+1].begin()) )
18 | )
19 | begin: (->Transform(@pos, @scale, @angle, ss[0].begin()))
20 | end: (->Transform(@pos, @scale, @angle, ss[num-1].end()))
21 | })
22 |
23 | skeletonA = skeleton(5)
24 |
25 | main = skeletonA{
26 | ss[2] = kite{pos.x = 100, pos.y = 200}
27 | sat( Contact(begin(), {x: 30, y:200}) )
28 | sat( Contact(end(), {x: 200, y:150}) )
29 | }
--------------------------------------------------------------------------------
/examples/str.cgl:
--------------------------------------------------------------------------------
1 | Print($"1 + 2 + 3 = {1 + 2 + 3}")
2 | Print((x = 3, y = 5, $"x + 3*y = { x + 3*y }, 2*x + y = { 2*x + y }"))
3 | Print($"This \{{ $"is \{{ $"nested \{{ $"string \{{"interpolation"}\}" }\}" }\}" }\}.")
4 |
--------------------------------------------------------------------------------
/examples/syntax_test.cgl:
--------------------------------------------------------------------------------
1 | x = 0
2 |
3 | a = (->y=x+1,y=y+1, Print(y))
4 |
5 | b = (->x=3, Print(x))
6 |
7 | a()
8 | a()
9 | a()
10 |
11 | b()
12 | b()
13 |
14 | Print(x)
--------------------------------------------------------------------------------
/examples/syntax_test2.cgl:
--------------------------------------------------------------------------------
1 | a = 0.2, b = 0.3
2 |
3 | x\_100 = 0
4 | y\_100 = 0
5 | x = x^2 - y^2 + a
6 | y = 2*x*y + b
7 |
8 | Print([x, y])
9 |
--------------------------------------------------------------------------------
/examples/syntax_test3.cgl:
--------------------------------------------------------------------------------
1 | f = (n ->
2 | if n <= 1
3 | then n
4 | else f(n - 1) + f(n - 2)
5 | )
6 |
7 | for i in 0:9 do Print(f(i))
8 |
--------------------------------------------------------------------------------
/examples/test1.cgl:
--------------------------------------------------------------------------------
1 | main = {
2 | a: Square{scale=X2(100), angle=45}
3 | b: a{pos= a.bottomLeft(),
4 | sat( Distant(a.bottom(), top(), 10) & parallel([a.top(), a.bottom()], [a.bottom(), top()]) ),
5 | var(pos)}
6 | c: a{pos= a.topRight(),
7 | sat( Distant(a.right(), left(), 10) & parallel([a.left(), a.right()], [a.right(), left()]) ),
8 | var(pos)}
9 | }
10 |
--------------------------------------------------------------------------------
/examples/test2.cgl:
--------------------------------------------------------------------------------
1 | arrow = Shape{
2 | body: Square{scale = Vec2(20, 200), sat(a=0,a:1,Contact(bottom(), Vec2(0, 0))), var(pos)}
3 | head: Triangle{scale = Vec2(50, 50), sat(Contact(bottom(), body.top())), var(pos)}
4 | begin: (->globalPos(body.bottom()))
5 | end: (->globalPos(head.top()))
6 | length: (->length(Sub(begin(), end())))
7 | }
8 |
9 | main = {
10 | a: Square{scale=X2(100)}
11 | offset = 0.1
12 | p = SubPath(ShapeOuterPath({s: Buffer(a, 30)})[0], offset+0, offset+0.25)
13 | b = arrow{}
14 | c: DeformShapeByPath2(b, p, b.begin(), b.end())
15 | }
--------------------------------------------------------------------------------
/examples/test3.cgl:
--------------------------------------------------------------------------------
1 | testDiff = Shape{
2 | a= Square{scale=X2(100), angle=45}
3 | b= a{pos=Vec2(75, 0)}
4 | c: Shape{a: Diff(a, b)}
5 | }
6 |
7 | testUnion = Shape{
8 | a= Square{scale=X2(100), angle=45}
9 | b= a{pos=Vec2(75, 0)}
10 | c: Shape{a: Union(a, b)}
11 | }
12 |
13 | testIntersect = Shape{
14 | a= Square{scale=X2(100), angle=45}
15 | b= a{pos=Vec2(75, 0)}
16 | c: Shape{a: Intersect(a, b)}
17 | }
18 |
19 | testSymDiff = Shape{
20 | a= Square{scale=X2(100), angle=45}
21 | b= a{pos=Vec2(75, 0)}
22 | c: Shape{a: SymDiff(a, b)}
23 | }
24 |
25 | main = Shape{
26 | ss: [
27 | testDiff{pos=Vec2(0, 0)}
28 | testUnion{pos=Vec2(0, 150)}
29 | testIntersect{pos=Vec2(0, 300)}
30 | testSymDiff{pos=Vec2(0, 450)}
31 | ]
32 | ss2: for i in 0:3 list(
33 | Shape{
34 | s: ShapeOuterPath(ss[i])
35 | stroke: Rgb(0,0,0)
36 | stroke_width: 5.0
37 | pos=Vec2(250,0)
38 | }
39 | )
40 | }
--------------------------------------------------------------------------------
/examples/test4.cgl:
--------------------------------------------------------------------------------
1 | testUnion = Shape{
2 | a= Square{scale=X2(100), angle=45}
3 | b= a{pos=Vec2(75, 0)}
4 | c: Shape{a: Union(a, b)}
5 | }
6 |
7 | main = Shape{
8 | a: testUnion{fill: Rgb(128, 128, 128)}
9 | b: Shape{
10 | text: BuildText("中央")
11 | pos = Vec2(100, 100)
12 | }
13 | sat( Contact(BoundingBox(b).center, BoundingBox(a).center) )
14 | var(b.pos)
15 | }
--------------------------------------------------------------------------------
/examples/text_packing.cgl:
--------------------------------------------------------------------------------
1 | NotIntersectsMin = (a, b -> intersection(a, b) + Area(BoundingBox(a, b)))
2 |
3 | main = Shape{
4 | a: text{
5 | str: "図"
6 | }
7 | b: text{
8 | str: "形"
9 | }
10 | sat(NotIntersectsMin(a, b))
11 | var(b.pos)
12 | }
--------------------------------------------------------------------------------
/examples/triforce.cgl:
--------------------------------------------------------------------------------
1 | transformA = (pos, scale, angle, polygon ->
2 | cosT:Cos(angle)
3 | sinT:Sin(angle)
4 | {
5 | x:pos.x + cosT * scale.x * polygon.x - sinT * scale.y * polygon.y
6 | y:pos.y + sinT * scale.x * polygon.x + cosT * scale.y * polygon.y
7 | }
8 | )
9 |
10 | transformB = (s, polygon ->
11 | cosT:Cos(s.angle)
12 | sinT:Sin(s.angle)
13 | {
14 | x:s.pos.x + cosT * s.scale.x * polygon.x - sinT * s.scale.y * polygon.y
15 | y:s.pos.y + sinT* s.scale.x * polygon.x + cosT* s.scale.y * polygon.y
16 | }
17 | )
18 |
19 | regularTriangle = Shape{
20 | polygon: [
21 | {x: 0, y: 0}, {x: 10, y: 10}, {x: 0, y: 10}
22 | ]
23 | sat( Cmaes(polygon[1]) & Distant(polygon[0], polygon[1], 100) & Distant(polygon[1], polygon[2], 100) & Distant(polygon[2], polygon[0], 100) )
24 | var(polygon[1], polygon[2])
25 | }
26 |
27 | regularTriangleT = regularTriangle{
28 | sat( transformA(pos, scale, angle, polygon[1]).y == transformA(pos, scale, angle, polygon[2]).y )
29 | var(angle)
30 | }
31 |
32 | main = Shape{
33 | a: regularTriangleT{pos= {x:150, y:50}}
34 | b: regularTriangleT{pos= {x:50, y:50}}
35 | c: regularTriangleT{pos= {x:250, y:50}}
36 | sat( Contact(transformB(a, a.polygon[2]), transformB(b, b.polygon[0])) & Contact(transformB(a, a.polygon[1]), transformB(c, c.polygon[0])))
37 | var(b.pos, c.pos)
38 | }
39 |
--------------------------------------------------------------------------------
/examples/vartest.cgl:
--------------------------------------------------------------------------------
1 | base = {
2 | ls: [Vec2(0,0), Vec2(10,0)]
3 | var(ls[0], ls[1])
4 | sat(ls[0].x == ls[1].x)
5 | }
6 |
7 | main = base{
8 | sat(ls[0].y == 20)
9 | }
10 |
11 | Print(main)
--------------------------------------------------------------------------------
/external/Siv3D/LICENSE:
--------------------------------------------------------------------------------
1 | //----------------------------------------------------------------------------------------
2 | //
3 | // Copyright (c) 2008-2018 Ryo Suzuki
4 | // Copyright (c) 2016-2018 OpenSiv3D Project
5 | //
6 | // Licensed under the MIT License.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files(the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions :
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 | //
26 | //----------------------------------------------------------------------------------------
27 |
--------------------------------------------------------------------------------
/include/Pita/BinaryEvaluator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Node.hpp"
3 | #include "Context.hpp"
4 |
5 | namespace cgl
6 | {
7 | Val NotFunc(const Val& lhs, Context& env);
8 |
9 | Val PlusFunc(const Val& lhs, Context& env);
10 |
11 | Val MinusFunc(const Val& lhs, Context& env);
12 |
13 | Val AndFunc(const Val& lhs, const Val& rhs, Context& env);
14 |
15 | Val OrFunc(const Val& lhs, const Val& rhs, Context& env);;
16 |
17 | bool EqualFunc(const Val& lhs, const Val& rhs, Context& env);
18 |
19 | bool NotEqualFunc(const Val& lhs, const Val& rhs, Context& env);
20 |
21 | bool LessThanFunc(const Val& lhs, const Val& rhs, Context& env);
22 |
23 | bool LessEqualFunc(const Val& lhs, const Val& rhs, Context& env);
24 |
25 | bool GreaterThanFunc(const Val& lhs, const Val& rhs, Context& env);
26 |
27 | bool GreaterEqualFunc(const Val& lhs, const Val& rhs, Context& env);
28 |
29 | Val MaxFunc(const Val& lhs, const Val& rhs, Context& env);
30 |
31 | Val MinFunc(const Val& lhs, const Val& rhs, Context& env);
32 |
33 | Val AbsFunc(const Val& lhs, Context& env);
34 |
35 | Val SinFunc(const Val& lhs);
36 |
37 | Val CosFunc(const Val& lhs);
38 |
39 | Val AddFunc(const Val& lhs, const Val& rhs, Context& env);
40 |
41 | Val SubFunc(const Val& lhs, const Val& rhs, Context& env);
42 |
43 | Val MulFunc(const Val& lhs, const Val& rhs, Context& env);
44 |
45 | Val DivFunc(const Val& lhs, const Val& rhs, Context& env);
46 |
47 | Val PowFunc(const Val& lhs, const Val& rhs, Context& env);
48 |
49 | Val ConcatFunc(const Val& lhs, const Val& rhs, Context& env);
50 |
51 | Val SetDiffFunc(const Val& lhs, const Val& rhs, Context& env);
52 | }
53 |
--------------------------------------------------------------------------------
/include/Pita/ClosureMaker.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Node.hpp"
3 |
4 | namespace cgl
5 | {
6 | class Context;
7 |
8 | //関数式を構成する識別子が関数内部で閉じているものか、外側のスコープに依存しているものかを調べ
9 | //外側のスコープを参照する識別子をアドレスに置き換えた式を返す
10 | Expr AsClosure(Context& context, const Expr& expr, const std::set& functionArguments = {});
11 | }
12 |
--------------------------------------------------------------------------------
/include/Pita/ExprTransformer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #pragma warning(disable:4996)
3 |
4 | #include "Node.hpp"
5 |
6 | namespace cgl
7 | {
8 | //Expr -> Expr の変換を行う処理全般のひな型
9 | class ExprTransformer : public boost::static_visitor
10 | {
11 | public:
12 | ExprTransformer() = default;
13 | virtual ~ExprTransformer() = default;
14 |
15 | virtual Expr operator()(const LRValue& node);
16 | virtual Expr operator()(const Identifier& node);
17 | virtual Expr operator()(const UnaryExpr& node);
18 | virtual Expr operator()(const BinaryExpr& node);
19 | virtual Expr operator()(const Lines& node);
20 | virtual Expr operator()(const DefFunc& node);
21 | virtual Expr operator()(const If& node);
22 | virtual Expr operator()(const For& node);
23 | virtual Expr operator()(const ListConstractor& node);
24 | virtual Expr operator()(const KeyExpr& node);
25 | virtual Expr operator()(const RecordConstractor& node);
26 | virtual Expr operator()(const Accessor& node);
27 | virtual Expr operator()(const DeclSat& node);
28 | virtual Expr operator()(const DeclFree& node);
29 | virtual Expr operator()(const Import& node);
30 | virtual Expr operator()(const Range& node);
31 | virtual Expr operator()(const Return& node);
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/include/Pita/FontShape.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #pragma warning(disable:4996)
3 | #include "Vectorizer.hpp"
4 |
5 | struct stbtt_fontinfo;
6 |
7 | namespace cgl
8 | {
9 | static unsigned char current_buffer[1 << 25];
10 |
11 | bool IsClockWise(const Vector& closedPath);
12 |
13 | class FontBuilder
14 | {
15 | public:
16 | FontBuilder();
17 | FontBuilder(const std::string& fontPath);
18 | ~FontBuilder();
19 |
20 | Geometries makePolygon(int codePoint, int quality = 1, double offsetX = 0, double offsetY = 0);
21 |
22 | Geometries textToPolygon(const std::string& str, int quality = 1);
23 |
24 | double glyphWidth(int codePoint);
25 |
26 | int ascent()const
27 | {
28 | return std::max(ascent1, ascent2);
29 | }
30 |
31 | int descent()const
32 | {
33 | return std::min(descent1, descent2);
34 | }
35 |
36 | int lineGap()const
37 | {
38 | return std::max(lineGap1, lineGap2);
39 | }
40 |
41 | double scaledHeight()const;
42 | void setScaledHeight(double newScale);
43 |
44 | private:
45 | void checkClockWise();
46 |
47 | double fontSizeToReal(int fontSize)const
48 | {
49 | return fontSize * baseScale;
50 | }
51 |
52 | std::string fontDataRawEN, fontDataRawJP;
53 | stbtt_fontinfo *fontInfo1 = nullptr, *fontInfo2 = nullptr;
54 | int ascent1 = 0, descent1 = 0, lineGap1 = 0;
55 | int ascent2 = 0, descent2 = 0, lineGap2 = 0;
56 | bool clockWisePolygons;
57 | double baseScale = 0.05;
58 | };
59 | }
60 |
--------------------------------------------------------------------------------
/include/Pita/Licences/CppNumericalSolvers:
--------------------------------------------------------------------------------
1 | R"(
2 | CppNumericalSolvers
3 |
4 | The MIT License (MIT)
5 |
6 | Copyright (c) 2014-2015 Patrick Wieschollek
7 | Copyright (c) 2015- the respective contributors
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy
10 | of this software and associated documentation files (the "Software"), to deal
11 | in the Software without restriction, including without limitation the rights
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | copies of the Software, and to permit persons to whom the Software is
14 | furnished to do so, subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be included in all
17 | copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | SOFTWARE.
26 | )"
27 |
--------------------------------------------------------------------------------
/include/Pita/Licences/Eigen:
--------------------------------------------------------------------------------
1 | R"(
2 | Eigen
3 |
4 | The MIT License (MIT)
5 |
6 | Copyright (c) 2014-2015 Patrick Wieschollek
7 | Copyright (c) 2015- the respective contributors
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy
10 | of this software and associated documentation files (the "Software"), to deal
11 | in the Software without restriction, including without limitation the rights
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | copies of the Software, and to permit persons to whom the Software is
14 | furnished to do so, subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be included in all
17 | copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | SOFTWARE.
26 | )"
27 |
--------------------------------------------------------------------------------
/include/Pita/Licences/OpenSiv3D:
--------------------------------------------------------------------------------
1 | R"(
2 | OpenSiv3D
3 |
4 | Copyright (c) 2008-2018 Ryo Suzuki
5 | Copyright (c) 2016-2018 OpenSiv3D Project
6 |
7 | Licensed under the MIT License.
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy
10 | of this software and associated documentation files(the "Software"), to deal
11 | in the Software without restriction, including without limitation the rights
12 | to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
13 | copies of the Software, and to permit persons to whom the Software is
14 | furnished to do so, subject to the following conditions :
15 |
16 | The above copyright notice and this permission notice shall be included in
17 | all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | THE SOFTWARE.
26 | )"
27 |
--------------------------------------------------------------------------------
/include/Pita/Licences/cereal:
--------------------------------------------------------------------------------
1 | R"(
2 | cereal
3 |
4 | Copyright (c) 2014, Randolph Voorhies, Shane Grant
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 | * Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 | * Redistributions in binary form must reproduce the above copyright
12 | notice, this list of conditions and the following disclaimer in the
13 | documentation and/or other materials provided with the distribution.
14 | * Neither the name of cereal nor the
15 | names of its contributors may be used to endorse or promote products
16 | derived from this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY
22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | )"
29 |
--------------------------------------------------------------------------------
/include/Pita/Licences/cxxopts:
--------------------------------------------------------------------------------
1 | R"(
2 | cxxopts
3 |
4 | Copyright (c) 2014 Jarryd Beck
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | )"
24 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_1:
--------------------------------------------------------------------------------
1 | R"(
2 | geos
3 |
4 | GNU LESSER GENERAL PUBLIC LICENSE
5 | Version 2.1, February 1999
6 |
7 | Copyright (C) 1991, 1999 Free Software Foundation, Inc.
8 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9 | Everyone is permitted to copy and distribute verbatim copies
10 | of this license document, but changing it is not allowed.
11 |
12 | [This is the first released version of the Lesser GPL. It also counts
13 | as the successor of the GNU Library Public License, version 2, hence
14 | the version number 2.1.]
15 |
16 | Preamble
17 |
18 | The licenses for most software are designed to take away your
19 | freedom to share and change it. By contrast, the GNU General Public
20 | Licenses are intended to guarantee your freedom to share and change
21 | free software--to make sure the software is free for all its users.
22 |
23 | This license, the Lesser General Public License, applies to some
24 | specially designated software packages--typically libraries--of the
25 | Free Software Foundation and other authors who decide to use it. You
26 | can use it too, but we suggest you first think carefully about whether
27 | this license or the ordinary General Public License is the better
28 | strategy to use in any particular case, based on the explanations below.
29 |
30 | When we speak of free software, we are referring to freedom of use,
31 | not price. Our General Public Licenses are designed to make sure that
32 | you have the freedom to distribute copies of free software (and charge
33 | for this service if you wish); that you receive source code or can get
34 | it if you want it; that you can change the software and use pieces of
35 | it in new free programs; and that you are informed that you can do
36 | these things.
37 | )"
38 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_10:
--------------------------------------------------------------------------------
1 | R"(
2 | For an executable, the required form of the "work that uses the
3 | Library" must include any data and utility programs needed for
4 | reproducing the executable from it. However, as a special exception,
5 | the materials to be distributed need not include anything that is
6 | normally distributed (in either source or binary form) with the major
7 | components (compiler, kernel, and so on) of the operating system on
8 | which the executable runs, unless that component itself accompanies
9 | the executable.
10 |
11 | It may happen that this requirement contradicts the license
12 | restrictions of other proprietary libraries that do not normally
13 | accompany the operating system. Such a contradiction means you cannot
14 | use both them and the Library together in an executable that you
15 | distribute.
16 |
17 | 7. You may place library facilities that are a work based on the
18 | Library side-by-side in a single library together with other library
19 | facilities not covered by this License, and distribute such a combined
20 | library, provided that the separate distribution of the work based on
21 | the Library and of the other library facilities is otherwise
22 | permitted, and provided that you do these two things:
23 |
24 | a) Accompany the combined library with a copy of the same work
25 | based on the Library, uncombined with any other library
26 | facilities. This must be distributed under the terms of the
27 | Sections above.
28 |
29 | b) Give prominent notice with the combined library of the fact
30 | that part of it is a work based on the Library, and explaining
31 | where to find the accompanying uncombined form of the same work.
32 |
33 | 8. You may not copy, modify, sublicense, link with, or distribute
34 | the Library except as expressly provided under this License. Any
35 | attempt otherwise to copy, modify, sublicense, link with, or
36 | distribute the Library is void, and will automatically terminate your
37 | rights under this License. However, parties who have received copies,
38 | or rights, from you under this License will not have their licenses
39 | terminated so long as such parties remain in full compliance.
40 | )"
41 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_12:
--------------------------------------------------------------------------------
1 | R"(
2 | 12. If the distribution and/or use of the Library is restricted in
3 | certain countries either by patents or by copyrighted interfaces, the
4 | original copyright holder who places the Library under this License may add
5 | an explicit geographical distribution limitation excluding those countries,
6 | so that distribution is permitted only in or among countries not thus
7 | excluded. In such case, this License incorporates the limitation as if
8 | written in the body of this License.
9 |
10 | 13. The Free Software Foundation may publish revised and/or new
11 | versions of the Lesser General Public License from time to time.
12 | Such new versions will be similar in spirit to the present version,
13 | but may differ in detail to address new problems or concerns.
14 |
15 | Each version is given a distinguishing version number. If the Library
16 | specifies a version number of this License which applies to it and
17 | "any later version", you have the option of following the terms and
18 | conditions either of that version or of any later version published by
19 | the Free Software Foundation. If the Library does not specify a
20 | license version number, you may choose any version ever published by
21 | the Free Software Foundation.
22 |
23 | 14. If you wish to incorporate parts of the Library into other free
24 | programs whose distribution conditions are incompatible with these,
25 | write to the author to ask for permission. For software which is
26 | copyrighted by the Free Software Foundation, write to the Free
27 | Software Foundation; we sometimes make exceptions for this. Our
28 | decision will be guided by the two goals of preserving the free status
29 | of all derivatives of our free software and of promoting the sharing
30 | and reuse of software generally.
31 |
32 | NO WARRANTY
33 | )"
34 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_13:
--------------------------------------------------------------------------------
1 | R"(
2 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
3 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
4 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
5 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
6 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
7 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
9 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
10 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
11 |
12 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
13 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
14 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
15 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
16 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
17 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
18 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
19 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
20 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
21 | DAMAGES.
22 |
23 | END OF TERMS AND CONDITIONS
24 |
25 | How to Apply These Terms to Your New Libraries
26 |
27 | If you develop a new library, and you want it to be of the greatest
28 | possible use to the public, we recommend making it free software that
29 | everyone can redistribute and change. You can do so by permitting
30 | redistribution under these terms (or, alternatively, under the terms of the
31 | ordinary General Public License).
32 |
33 | To apply these terms, attach the following notices to the library. It is
34 | safest to attach them to the start of each source file to most effectively
35 | convey the exclusion of warranty; and each file should have at least the
36 | "copyright" line and a pointer to where the full notice is found.
37 | )"
38 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_14:
--------------------------------------------------------------------------------
1 | R"(
2 |
3 | Copyright (C)
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 |
19 | Also add information on how to contact you by electronic and paper mail.
20 |
21 | You should also get your employer (if you work as a programmer) or your
22 | school, if any, to sign a "copyright disclaimer" for the library, if
23 | necessary. Here is a sample; alter the names:
24 |
25 | Yoyodyne, Inc., hereby disclaims all copyright interest in the
26 | library `Frob' (a library for tweaking knobs) written by James Random Hacker.
27 |
28 | , 1 April 1990
29 | Ty Coon, President of Vice
30 |
31 | That's all there is to it!
32 | )"
33 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_2:
--------------------------------------------------------------------------------
1 | R"(
2 | To protect your rights, we need to make restrictions that forbid
3 | distributors to deny you these rights or to ask you to surrender these
4 | rights. These restrictions translate to certain responsibilities for
5 | you if you distribute copies of the library or if you modify it.
6 |
7 | For example, if you distribute copies of the library, whether gratis
8 | or for a fee, you must give the recipients all the rights that we gave
9 | you. You must make sure that they, too, receive or can get the source
10 | code. If you link other code with the library, you must provide
11 | complete object files to the recipients, so that they can relink them
12 | with the library after making changes to the library and recompiling
13 | it. And you must show them these terms so they know their rights.
14 |
15 | We protect your rights with a two-step method: (1) we copyright the
16 | library, and (2) we offer you this license, which gives you legal
17 | permission to copy, distribute and/or modify the library.
18 |
19 | To protect each distributor, we want to make it very clear that
20 | there is no warranty for the free library. Also, if the library is
21 | modified by someone else and passed on, the recipients should know
22 | that what they have is not the original version, so that the original
23 | author's reputation will not be affected by problems that might be
24 | introduced by others.
25 |
26 | Finally, software patents pose a constant threat to the existence of
27 | any free program. We wish to make sure that a company cannot
28 | effectively restrict the users of a free program by obtaining a
29 | restrictive license from a patent holder. Therefore, we insist that
30 | any patent license obtained for a version of the library must be
31 | consistent with the full freedom of use specified in this license.
32 | )"
33 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_3:
--------------------------------------------------------------------------------
1 | R"(
2 | Most GNU software, including some libraries, is covered by the
3 | ordinary GNU General Public License. This license, the GNU Lesser
4 | General Public License, applies to certain designated libraries, and
5 | is quite different from the ordinary General Public License. We use
6 | this license for certain libraries in order to permit linking those
7 | libraries into non-free programs.
8 |
9 | When a program is linked with a library, whether statically or using
10 | a shared library, the combination of the two is legally speaking a
11 | combined work, a derivative of the original library. The ordinary
12 | General Public License therefore permits such linking only if the
13 | entire combination fits its criteria of freedom. The Lesser General
14 | Public License permits more lax criteria for linking other code with
15 | the library.
16 |
17 | We call this license the "Lesser" General Public License because it
18 | does Less to protect the user's freedom than the ordinary General
19 | Public License. It also provides other free software developers Less
20 | of an advantage over competing non-free programs. These disadvantages
21 | are the reason we use the ordinary General Public License for many
22 | libraries. However, the Lesser license provides advantages in certain
23 | special circumstances.
24 |
25 | For example, on rare occasions, there may be a special need to
26 | encourage the widest possible use of a certain library, so that it becomes
27 | a de-facto standard. To achieve this, non-free programs must be
28 | allowed to use the library. A more frequent case is that a free
29 | library does the same job as widely used non-free libraries. In this
30 | case, there is little to gain by limiting the free library to free
31 | software only, so we use the Lesser General Public License.
32 |
33 | In other cases, permission to use a particular library in non-free
34 | programs enables a greater number of people to use a large body of
35 | free software. For example, permission to use the GNU C Library in
36 | non-free programs enables many more people to use the whole GNU
37 | operating system, as well as its variant, the GNU/Linux operating
38 | system.
39 | )"
40 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_5:
--------------------------------------------------------------------------------
1 | R"(
2 | 1. You may copy and distribute verbatim copies of the Library's
3 | complete source code as you receive it, in any medium, provided that
4 | you conspicuously and appropriately publish on each copy an
5 | appropriate copyright notice and disclaimer of warranty; keep intact
6 | all the notices that refer to this License and to the absence of any
7 | warranty; and distribute a copy of this License along with the
8 | Library.
9 |
10 | You may charge a fee for the physical act of transferring a copy,
11 | and you may at your option offer warranty protection in exchange for a
12 | fee.
13 | )"
14 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_7:
--------------------------------------------------------------------------------
1 | R"(
2 | 3. You may opt to apply the terms of the ordinary GNU General Public
3 | License instead of this License to a given copy of the Library. To do
4 | this, you must alter all the notices that refer to this License, so
5 | that they refer to the ordinary GNU General Public License, version 2,
6 | instead of to this License. (If a newer version than version 2 of the
7 | ordinary GNU General Public License has appeared, then you can specify
8 | that version instead if you wish.) Do not make any other change in
9 | these notices.
10 |
11 | Once this change is made in a given copy, it is irreversible for
12 | that copy, so the ordinary GNU General Public License applies to all
13 | subsequent copies and derivative works made from that copy.
14 |
15 | This option is useful when you wish to copy part of the code of
16 | the Library into a program that is not a library.
17 |
18 | 4. You may copy and distribute the Library (or a portion or
19 | derivative of it, under Section 2) in object code or executable form
20 | under the terms of Sections 1 and 2 above provided that you accompany
21 | it with the complete corresponding machine-readable source code, which
22 | must be distributed under the terms of Sections 1 and 2 above on a
23 | medium customarily used for software interchange.
24 |
25 | If distribution of object code is made by offering access to copy
26 | from a designated place, then offering equivalent access to copy the
27 | source code from the same place satisfies the requirement to
28 | distribute the source code, even though third parties are not
29 | compelled to copy the source along with the object code.
30 |
31 | 5. A program that contains no derivative of any portion of the
32 | Library, but is designed to work with the Library by being compiled or
33 | linked with it, is called a "work that uses the Library". Such a
34 | work, in isolation, is not a derivative work of the Library, and
35 | therefore falls outside the scope of this License.
36 |
37 | However, linking a "work that uses the Library" with the Library
38 | creates an executable that is a derivative of the Library (because it
39 | contains portions of the Library), rather than a "work that uses the
40 | library". The executable is therefore covered by this License.
41 | Section 6 states terms for distribution of such executables.
42 | )"
43 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_8:
--------------------------------------------------------------------------------
1 | R"(
2 | When a "work that uses the Library" uses material from a header file
3 | that is part of the Library, the object code for the work may be a
4 | derivative work of the Library even though the source code is not.
5 | Whether this is true is especially significant if the work can be
6 | linked without the Library, or if the work is itself a library. The
7 | threshold for this to be true is not precisely defined by law.
8 |
9 | If such an object file uses only numerical parameters, data
10 | structure layouts and accessors, and small macros and small inline
11 | functions (ten lines or less in length), then the use of the object
12 | file is unrestricted, regardless of whether it is legally a derivative
13 | work. (Executables containing this object code plus portions of the
14 | Library will still fall under Section 6.)
15 |
16 | Otherwise, if the work is a derivative of the Library, you may
17 | distribute the object code for the work under the terms of Section 6.
18 | Any executables containing that work also fall under Section 6,
19 | whether or not they are linked directly with the Library itself.
20 |
21 | 6. As an exception to the Sections above, you may also combine or
22 | link a "work that uses the Library" with the Library to produce a
23 | work containing portions of the Library, and distribute that work
24 | under terms of your choice, provided that the terms permit
25 | modification of the work for the customer's own use and reverse
26 | engineering for debugging such modifications.
27 |
28 | You must give prominent notice with each copy of the work that the
29 | Library is used in it and that the Library and its use are covered by
30 | this License. You must supply a copy of this License. If the work
31 | during execution displays copyright notices, you must include the
32 | copyright notice for the Library among them, as well as a reference
33 | directing the user to the copy of this License. Also, you must do one
34 | of these things:
35 | )"
36 |
--------------------------------------------------------------------------------
/include/Pita/Licences/geos_9:
--------------------------------------------------------------------------------
1 | R"(
2 | a) Accompany the work with the complete corresponding
3 | machine-readable source code for the Library including whatever
4 | changes were used in the work (which must be distributed under
5 | Sections 1 and 2 above); and, if the work is an executable linked
6 | with the Library, with the complete machine-readable "work that
7 | uses the Library", as object code and/or source code, so that the
8 | user can modify the Library and then relink to produce a modified
9 | executable containing the modified Library. (It is understood
10 | that the user who changes the contents of definitions files in the
11 | Library will not necessarily be able to recompile the application
12 | to use the modified definitions.)
13 |
14 | b) Use a suitable shared library mechanism for linking with the
15 | Library. A suitable mechanism is one that (1) uses at run time a
16 | copy of the library already present on the user's computer system,
17 | rather than copying library functions into the executable, and (2)
18 | will operate properly with a modified version of the library, if
19 | the user installs one, as long as the modified version is
20 | interface-compatible with the version that the work was made with.
21 |
22 | c) Accompany the work with a written offer, valid for at
23 | least three years, to give the same user the materials
24 | specified in Subsection 6a, above, for a charge no more
25 | than the cost of performing this distribution.
26 |
27 | d) If distribution of the work is made by offering access to copy
28 | from a designated place, offer equivalent access to copy the above
29 | specified materials from the same place.
30 |
31 | e) Verify that the user has already received a copy of these
32 | materials or that you have already sent this user a copy.
33 | )"
34 |
--------------------------------------------------------------------------------
/include/Pita/Licences/libcmaes_1:
--------------------------------------------------------------------------------
1 | R"(
2 | libcmaes
3 |
4 | GNU LESSER GENERAL PUBLIC LICENSE
5 | Version 3, 29 June 2007
6 |
7 | Copyright (C) 2007 Free Software Foundation, Inc.
8 | Everyone is permitted to copy and distribute verbatim copies
9 | of this license document, but changing it is not allowed.
10 |
11 |
12 | This version of the GNU Lesser General Public License incorporates
13 | the terms and conditions of version 3 of the GNU General Public
14 | License, supplemented by the additional permissions listed below.
15 |
16 | 0. Additional Definitions.
17 |
18 | As used herein, "this License" refers to version 3 of the GNU Lesser
19 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
20 | General Public License.
21 |
22 | "The Library" refers to a covered work governed by this License,
23 | other than an Application or a Combined Work as defined below.
24 |
25 | An "Application" is any work that makes use of an interface provided
26 | by the Library, but which is not otherwise based on the Library.
27 | Defining a subclass of a class defined by the Library is deemed a mode
28 | of using an interface provided by the Library.
29 |
30 | A "Combined Work" is a work produced by combining or linking an
31 | Application with the Library. The particular version of the Library
32 | with which the Combined Work was made is also called the "Linked
33 | Version".
34 |
35 | The "Minimal Corresponding Source" for a Combined Work means the
36 | Corresponding Source for the Combined Work, excluding any source code
37 | for portions of the Combined Work that, considered in isolation, are
38 | based on the Application, and not on the Linked Version.
39 | )"
40 |
--------------------------------------------------------------------------------
/include/Pita/Licences/libcmaes_2:
--------------------------------------------------------------------------------
1 | R"(
2 | The "Corresponding Application Code" for a Combined Work means the
3 | object code and/or source code for the Application, including any data
4 | and utility programs needed for reproducing the Combined Work from the
5 | Application, but excluding the System Libraries of the Combined Work.
6 |
7 | 1. Exception to Section 3 of the GNU GPL.
8 |
9 | You may convey a covered work under sections 3 and 4 of this License
10 | without being bound by section 3 of the GNU GPL.
11 |
12 | 2. Conveying Modified Versions.
13 |
14 | If you modify a copy of the Library, and, in your modifications, a
15 | facility refers to a function or data to be supplied by an Application
16 | that uses the facility (other than as an argument passed when the
17 | facility is invoked), then you may convey a copy of the modified
18 | version:
19 |
20 | a) under this License, provided that you make a good faith effort to
21 | ensure that, in the event an Application does not supply the
22 | function or data, the facility still operates, and performs
23 | whatever part of its purpose remains meaningful, or
24 |
25 | b) under the GNU GPL, with none of the additional permissions of
26 | this License applicable to that copy.
27 |
28 | 3. Object Code Incorporating Material from Library Header Files.
29 | )"
30 |
--------------------------------------------------------------------------------
/include/Pita/Licences/libcmaes_3:
--------------------------------------------------------------------------------
1 | R"(
2 | The object code form of an Application may incorporate material from
3 | a header file that is part of the Library. You may convey such object
4 | code under terms of your choice, provided that, if the incorporated
5 | material is not limited to numerical parameters, data structure
6 | layouts and accessors, or small macros, inline functions and templates
7 | (ten or fewer lines in length), you do both of the following:
8 |
9 | a) Give prominent notice with each copy of the object code that the
10 | Library is used in it and that the Library and its use are
11 | covered by this License.
12 |
13 | b) Accompany the object code with a copy of the GNU GPL and this license
14 | document.
15 |
16 | 4. Combined Works.
17 |
18 | You may convey a Combined Work under terms of your choice that,
19 | taken together, effectively do not restrict modification of the
20 | portions of the Library contained in the Combined Work and reverse
21 | engineering for debugging such modifications, if you also do each of
22 | the following:
23 |
24 | a) Give prominent notice with each copy of the Combined Work that
25 | the Library is used in it and that the Library and its use are
26 | covered by this License.
27 |
28 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
29 | document.
30 |
31 | c) For a Combined Work that displays copyright notices during
32 | execution, include the copyright notice for the Library among
33 | these notices, as well as a reference directing the user to the
34 | copies of the GNU GPL and this license document.
35 | )"
36 |
--------------------------------------------------------------------------------
/include/Pita/Licences/libcmaes_4:
--------------------------------------------------------------------------------
1 | R"(
2 | d) Do one of the following:
3 |
4 | 0) Convey the Minimal Corresponding Source under the terms of this
5 | License, and the Corresponding Application Code in a form
6 | suitable for, and under terms that permit, the user to
7 | recombine or relink the Application with a modified version of
8 | the Linked Version to produce a modified Combined Work, in the
9 | manner specified by section 6 of the GNU GPL for conveying
10 | Corresponding Source.
11 |
12 | 1) Use a suitable shared library mechanism for linking with the
13 | Library. A suitable mechanism is one that (a) uses at run time
14 | a copy of the Library already present on the user's computer
15 | system, and (b) will operate properly with a modified version
16 | of the Library that is interface-compatible with the Linked
17 | Version.
18 |
19 | e) Provide Installation Information, but only if you would otherwise
20 | be required to provide such information under section 6 of the
21 | GNU GPL, and only to the extent that such information is
22 | necessary to install and execute a modified version of the
23 | Combined Work produced by recombining or relinking the
24 | Application with a modified version of the Linked Version. (If
25 | you use option 4d0, the Installation Information must accompany
26 | the Minimal Corresponding Source and Corresponding Application
27 | Code. If you use option 4d1, you must provide the Installation
28 | Information in the manner specified by section 6 of the GNU GPL
29 | for conveying Corresponding Source.)
30 | )"
31 |
--------------------------------------------------------------------------------
/include/Pita/Licences/libcmaes_5:
--------------------------------------------------------------------------------
1 | R"(
2 | 5. Combined Libraries.
3 |
4 | You may place library facilities that are a work based on the
5 | Library side by side in a single library together with other library
6 | facilities that are not Applications and are not covered by this
7 | License, and convey such a combined library under terms of your
8 | choice, if you do both of the following:
9 |
10 | a) Accompany the combined library with a copy of the same work based
11 | on the Library, uncombined with any other library facilities,
12 | conveyed under the terms of this License.
13 |
14 | b) Give prominent notice with the combined library that part of it
15 | is a work based on the Library, and explaining where to find the
16 | accompanying uncombined form of the same work.
17 |
18 | 6. Revised Versions of the GNU Lesser General Public License.
19 |
20 | The Free Software Foundation may publish revised and/or new versions
21 | of the GNU Lesser General Public License from time to time. Such new
22 | versions will be similar in spirit to the present version, but may
23 | differ in detail to address new problems or concerns.
24 |
25 | Each version is given a distinguishing version number. If the
26 | Library as you received it specifies that a certain numbered version
27 | of the GNU Lesser General Public License "or any later version"
28 | applies to it, you have the option of following the terms and
29 | conditions either of that published version or of any later version
30 | published by the Free Software Foundation. If the Library as you
31 | received it does not specify a version number of the GNU Lesser
32 | General Public License, you may choose any version of the GNU Lesser
33 | General Public License ever published by the Free Software Foundation.
34 |
35 | If the Library as you received it specifies that a proxy can decide
36 | whether future versions of the GNU Lesser General Public License shall
37 | apply, that proxy's public statement of acceptance of any version is
38 | permanent authorization for you to choose that version for the
39 | Library.
40 | )"
41 |
--------------------------------------------------------------------------------
/include/Pita/Program.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | #include "Evaluator.hpp"
5 | #include "Node.hpp"
6 | #include "Context.hpp"
7 |
8 | namespace cgl
9 | {
10 | void UpdateCurrentLocation(const LocationInfo& info);
11 |
12 | struct ProfileResult
13 | {
14 | double parseSec;
15 | double executeSec;
16 | double outputSec;
17 |
18 | double operator[](size_t i)const
19 | {
20 | return i == 0 ? parseSec : (i == 1 ? executeSec : outputSec);
21 | }
22 |
23 | ProfileResult() = default;
24 | ProfileResult(double parseSec, double executeSec, double outputSec) :
25 | parseSec(parseSec), executeSec(executeSec), outputSec(outputSec)
26 | {}
27 | };
28 |
29 | class Program
30 | {
31 | public:
32 | Program();
33 |
34 | //boost::optional execute(const std::string& program);
35 |
36 | //bool draw(const std::string& program, bool logOutput = true);
37 |
38 | void execute1(const std::string& input_filename, const std::string& output_filename, bool logOutput = true);
39 | void executeInline(const std::string& source, bool logOutput = true);
40 | std::string executeAsString(const std::string& source);
41 | //void run(const std::string& program, bool logOutput = true);
42 |
43 | void clearState();
44 |
45 | bool test(const std::string& input_filepath, const Expr& expr);
46 |
47 | std::shared_ptr getContext()
48 | {
49 | return pEnv;
50 | }
51 |
52 | boost::optional& getVal()
53 | {
54 | return evaluated;
55 | }
56 |
57 | bool isSucceeded()const
58 | {
59 | return succeeded;
60 | }
61 |
62 | boost::optional asIntOpt();
63 | boost::optional asDoubleOpt();
64 |
65 | bool preEvaluate(const std::string& input_filename, const std::string& output_filename, bool logOutput = true);
66 |
67 | const ProfileResult& profileResult()const
68 | {
69 | return profileTime;
70 | }
71 |
72 | private:
73 | ProfileResult profileTime;
74 | std::shared_ptr pEnv;
75 | //Eval evaluator;
76 | boost::optional evaluated;
77 | bool succeeded;
78 | bool isInitialized;
79 | };
80 | }
81 |
--------------------------------------------------------------------------------
/include/Pita/TreeLogger.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #pragma warning(disable:4996)
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | namespace cgl
12 | {
13 | class TreeLogger
14 | {
15 | public:
16 | TreeLogger() = default;
17 | ~TreeLogger()
18 | {
19 | logFinish();
20 | }
21 |
22 | static TreeLogger& instance()
23 | {
24 | static TreeLogger logger;
25 | return logger;
26 | }
27 |
28 | void push(const std::string& message)
29 | {
30 | if (ofs.is_open())
31 | {
32 | messages.push(message);
33 | ofs << std::string("") + escaped(message) + "
\n\n";
34 | }
35 | }
36 |
37 | void pop()
38 | {
39 | if (ofs.is_open())
40 | {
41 | messages.pop();
42 | ofs << "
\n \n";
43 | }
44 | }
45 |
46 | void write(const std::string& message)
47 | {
48 | if (ofs.is_open())
49 | {
50 | ofs << std::string("") + escaped(message) + "
\n";
51 | }
52 | }
53 |
54 | void logStart(const std::string& filePath)
55 | {
56 | logFinish();
57 |
58 | ofs.open(filePath);
59 | printHead();
60 | }
61 |
62 | void logFinish()
63 | {
64 | if (ofs.is_open())
65 | {
66 | while (!messages.empty())
67 | {
68 | pop();
69 | }
70 |
71 | printTail();
72 | ofs.close();
73 | }
74 | }
75 |
76 | bool isEnable()const { return ofs.is_open(); }
77 |
78 | private:
79 | void printHead();
80 | void printTail();
81 | std::string escaped(const std::string& str);
82 |
83 | std::ofstream ofs;
84 | std::stack messages;
85 | };
86 |
87 | struct ScopeLog
88 | {
89 | ScopeLog() = delete;
90 |
91 | ScopeLog(const std::string& message)
92 | {
93 | TreeLogger::instance().push(message);
94 | }
95 |
96 | ~ScopeLog()
97 | {
98 | TreeLogger::instance().pop();
99 | }
100 |
101 | void write(const std::string& message)
102 | {
103 | TreeLogger::instance().write(message);
104 | }
105 | };
106 | }
107 |
--------------------------------------------------------------------------------
/include/Pita/Util.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace cgl
6 | {
7 | const double pi = 3.1415926535;
8 | const double deg2rad = pi / 180.0;
9 | const double rad2deg = 180.0 / pi;
10 |
11 | inline std::string AsUtf8(const std::u32string& input) {
12 | return std::string(
13 | boost::u32_to_u8_iterator(input.begin()),
14 | boost::u32_to_u8_iterator(input.end()));
15 | }
16 |
17 | inline std::u32string AsUtf32(const std::string& input) {
18 | return std::u32string(
19 | boost::u8_to_u32_iterator(input.begin()),
20 | boost::u8_to_u32_iterator(input.end()));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/include/Pita/ValueCloner.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #pragma warning(disable:4996)
3 |
4 | #include "Node.hpp"
5 | #include "Context.hpp"
6 |
7 | namespace cgl
8 | {
9 | Val Clone(std::shared_ptr pEnv, const Val& value, const LocationInfo& info);
10 | }
11 |
--------------------------------------------------------------------------------
/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.1)
2 |
3 | if (MSVC)
4 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /source-charset:utf-8")
5 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /source-charset:utf-8")
6 | endif()
7 |
8 |
9 | add_executable(pita_test pita_test.cpp)
10 | #target_link_libraries(pita_test pita_lib boost_serialization boost_system boost_filesystem)
11 | target_link_libraries(pita_test pita_lib)
12 |
13 | add_test(
14 | NAME pita_test
15 | COMMAND $
16 | )
17 | set_tests_properties(pita_test PROPERTIES LABELS pita)
18 |
19 |
20 | add_executable(pita_examples pita_examples.cpp)
21 | #target_link_libraries(pita_examples pita_lib boost_serialization boost_system boost_filesystem)
22 | target_link_libraries(pita_examples pita_lib)
23 |
24 | add_test(
25 | NAME pita_strict
26 | COMMAND $ --run_test=cgl/test_examples_strict
27 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/examples
28 | )
29 | set_tests_properties(pita_strict PROPERTIES LABELS pita)
30 |
31 | add_test(
32 | NAME pita_easy
33 | COMMAND $ --run_test=cgl/test_examples_easy
34 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/examples
35 | )
36 | set_tests_properties(pita_easy PROPERTIES LABELS pita)
37 |
--------------------------------------------------------------------------------
/test/pita_test.cpp:
--------------------------------------------------------------------------------
1 | #define NOMINMAX
2 |
3 | #define BOOST_TEST_MAIN
4 | #include
5 |
6 | #include
7 |
8 | extern bool isDebugMode;
9 | extern bool isBlockingMode;
10 |
11 | BOOST_AUTO_TEST_SUITE(cgl)
12 |
13 | BOOST_AUTO_TEST_CASE(test_case1)
14 | {
15 | std::vector testCases({
16 | u8R"*(
17 | (
18 | Print("--- Parse tests ---")
19 |
20 | a = 1
21 | + 2
22 | Assert(a == 1, "comma separation(0)")
23 |
24 | Print("Passed")
25 | )
26 | (
27 | Print("--- Comment tests ---")
28 |
29 | //Assert(false, "line comment")
30 |
31 | /*
32 | Assert(false, "scope comment(0)")
33 | */
34 |
35 | a = 1
36 | /*
37 | a = 2
38 | //*/
39 | Assert(a == 1, "scope comment(1)")
40 |
41 | a = 1
42 | //*
43 | a = 2
44 | //*/
45 | Assert(a == 2, "scope comment(2)")
46 |
47 | /*
48 | Assert(false, "scope nest comment")
49 | /*
50 | Assert(false, "scope nest comment")
51 | */
52 | Assert(false, "scope nest comment")
53 | */
54 |
55 | Print("Passed")
56 | )
57 | )*",
58 | u8R"*(
59 | Print("--- ClosureMaker tests ---")
60 | (
61 | Base = {
62 | func1: (->0)
63 | }
64 |
65 | Derived = Base{
66 | func2: (->func1())
67 | }
68 |
69 | Assert(Derived.func2() == 0, "closure maker(1)")
70 | )
71 | (
72 | record = {
73 | a: 1
74 | }
75 | a = 2
76 | f = (->record{a = 3})
77 |
78 | r = f()
79 |
80 | Assert(a == 2, "closure maker(2)")
81 |
82 | //TODO
83 | //Assert(r.a == 3, "closure maker(3)")
84 |
85 | Print("Passed")
86 | )
87 | )*"
88 | });
89 |
90 | isDebugMode = true;
91 | isBlockingMode = false;
92 |
93 | for (const auto& source: testCases)
94 | {
95 | Program program;
96 | program.executeInline(source, false);
97 | BOOST_CHECK(program.isSucceeded());
98 | }
99 | }
100 |
101 | BOOST_AUTO_TEST_SUITE_END()
102 |
--------------------------------------------------------------------------------