stylet 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +4 -0
- data/.yardopts +2 -0
- data/Gemfile +16 -0
- data/README.org +19 -0
- data/Rakefile +17 -0
- data/bin/setup +63 -0
- data/bin/stylet +8 -0
- data/examples/.ruby-version +1 -0
- data/examples/00100_lib_hello_world.rb +8 -0
- data/examples/00110_lib_sge_check.rb +6 -0
- data/examples/00120_lib_/343/202/254/343/203/263/343/203/236/345/200/244/343/201/256/345/244/211/346/233/264.rb +22 -0
- data/examples/00130_lib_window_title.rb +8 -0
- data/examples/00140_lib_callbacks.rb +8 -0
- data/examples/00150_lib_vector.rb +5 -0
- data/examples/00160_lib_run.rb +4 -0
- data/examples/00170_lib_frame.rb +4 -0
- data/examples/00180_lib_config/347/242/272/350/252/215.rb +7 -0
- data/examples/00190_lib_/343/201/231/343/201/271/343/201/246/345/220/214/343/201/230/343/202/252/343/203/226/343/202/270/343/202/247/343/202/257/343/203/210.rb +10 -0
- data/examples/00200_lib_/343/203/254/343/202/267/343/203/274/343/203/220/343/203/274/343/202/222/347/234/201/347/225/245/343/201/231/343/202/213/346/226/271/346/263/225/343/201/256/343/203/206/343/202/271/343/203/210.rb +28 -0
- data/examples/00210_lib_delegators.rb +7 -0
- data/examples/00220_lib_template_method.rb +13 -0
- data/examples/00230_lib_/350/203/214/346/231/257/347/224/273/345/203/217/350/241/250/347/244/272.rb +9 -0
- data/examples/00240_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2171_/351/273/222/343/201/256/344/270/212/343/201/253/350/203/214/346/231/257.rb +18 -0
- data/examples/00250_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2172_/350/203/214/346/231/257/343/201/256/344/270/212/343/201/253/351/273/222.rb +17 -0
- data/examples/00260_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2173_/350/203/214/346/231/257/343/201/256/344/270/212/343/201/253/351/273/222_/347/224/273/351/235/242/343/202/265/343/202/244/343/202/272/343/203/225/343/202/243/343/203/203/343/203/210_/351/207/215/343/201/204.rb +27 -0
- data/examples/00270_lib_/350/203/214/346/231/257/347/224/273/345/203/217/343/202/222/346/232/227/343/201/2173_/350/203/214/346/231/257/343/201/256/344/270/212/343/201/253/351/273/222_/347/224/273/351/235/242/343/202/265/343/202/244/343/202/272/343/203/225/343/202/243/343/203/203/343/203/210_/351/253/230/351/200/237/345/214/226.rb +44 -0
- data/examples/00280_lib_/347/211/271/345/256/232/343/201/256/343/202/250/343/203/252/343/202/242/343/201/240/343/201/221/345/276/220/343/200/205/343/201/253/346/266/210/343/201/231.rb +26 -0
- data/examples/00290_lib_/350/203/214/346/231/257/350/211/262/345/244/211/346/233/264.rb +5 -0
- data/examples/00300_lib_/343/202/255/343/203/243/343/203/251/343/202/257/343/202/277/347/224/273/345/203/217/343/202/222/350/241/250/347/244/272/343/201/231/343/202/213/344/276/213.rb +17 -0
- data/examples/00310_lib_/343/202/255/343/203/243/343/203/251/343/202/257/343/202/277/347/224/273/345/203/217/343/201/256/343/202/242/343/203/213/343/203/241/343/203/274/343/202/267/343/203/247/343/203/263.rb +18 -0
- data/examples/00320_lib_/343/202/255/343/203/243/343/203/251/343/202/257/343/202/277/346/213/241/345/244/247/347/270/256/345/260/217/345/233/236/350/273/242.rb +21 -0
- data/examples/00330_joystick.rb +5 -0
- data/examples/00340_joystick_PS3/343/202/242/343/203/212/343/203/255/343/202/260/343/203/254/343/203/220/343/203/274/343/201/256/345/213/225/343/201/215/343/201/214/345/206/205/351/203/250/343/201/247/343/201/257/345/233/233/350/247/222.rb +30 -0
- data/examples/00350_joystick_PS3/343/202/242/343/203/212/343/203/255/343/202/260/343/203/254/343/203/220/343/203/274/343/201/256/350/252/277/346/225/264/346/270/210/343/201/277/343/203/231/343/202/257/343/203/210/343/203/253.rb +12 -0
- data/examples/00360_lib_mouse.rb +5 -0
- data/examples/00370_lib_input.rb +29 -0
- data/examples/00380_lib_vputs_align.rb +8 -0
- data/examples/00390_/343/203/225/343/202/251/343/203/263/343/203/210/344/270/200/350/246/247.rb +15 -0
- data/examples/00400_lib_draw_circle.rb +8 -0
- data/examples/00410_SDL/343/201/256draw_rect/343/201/2571/343/203/224/343/202/257/343/202/273/343/203/253/344/275/231/345/210/206/343/201/253/346/217/217/347/224/273/343/201/225/343/202/214/343/202/213/343/201/256/343/201/247/346/263/250/346/204/217.rb +7 -0
- data/examples/00420_circle_on_circle.rb +10 -0
- data/examples/00430_rotate.rb +16 -0
- data/examples/00440_draw_triangle.rb +7 -0
- data/examples/00450_parabora_triangle.rb +37 -0
- data/examples/00460_ice_hockey.rb +88 -0
- data/examples/00470_collision_block_vs_block.rb +120 -0
- data/examples/00480_simple_circle_controll.rb +37 -0
- data/examples/00490_/347/255/211/351/200/237/347/247/273/345/213/225_uniform_velocity_rain.rb +51 -0
- data/examples/00500_/345/212/240/351/200/237/346/224/276/347/211/251/347/267/232_parabora_volcano.rb +94 -0
- data/examples/00510_3d.rb +53 -0
- data/examples/00520_/343/203/210/343/203/253/343/203/215/343/201/256/343/203/241/343/203/213/343/203/245/343/203/274/351/242/250/343/201/256/345/213/225/343/201/215.rb +77 -0
- data/examples/00530_curve_2/346/254/241/343/203/231/343/202/270/343/202/247/346/233/262/347/267/232/343/201/250/347/233/264/347/267/232/343/201/250/343/201/256/344/272/244/347/202/271.rb +43 -0
- data/examples/00540_curve_3/346/254/241/343/203/231/343/202/270/343/202/247/346/233/262/347/267/232.rb +40 -0
- data/examples/00550_curve_N/346/254/241/343/203/231/343/202/270/343/202/247/346/233/262/347/267/232.rb +92 -0
- data/examples/00560_curve_/343/202/271/343/203/227/343/203/251/343/202/244/343/203/263/346/233/262/347/267/232.rb +113 -0
- data/examples/00570_/345/206/206/351/201/213/345/213/225_circle_jet_coaster.rb +52 -0
- data/examples/00580_/345/206/206/343/202/222/346/212/274/343/201/231/343/201/262/343/201/243/343/201/261/343/202/213_collision_circle_vs_circle_push_or_pull.rb +56 -0
- data/examples/00590_/350/212/213/350/231/253/343/202/264/343/203/240/347/264/220/343/203/207/343/203/242_collision_demo_circle_worm.rb +104 -0
- data/examples/00600_/346/214/257/343/202/212/345/255/220_swing.rb +145 -0
- data/examples/00610_/345/206/205/347/251/215/343/201/250/345/244/226/347/251/215_inner_product.rb +36 -0
- data/examples/00620_/346/263/225/347/267/232/343/203/231/343/202/257/343/203/210/343/203/253.rb +23 -0
- data/examples/00630_/345/206/206/343/201/250/345/206/206/343/201/256/345/217/215/345/260/204_collision_reflect_circle_vs_circle.rb +222 -0
- data/examples/00640_/347/202/271/343/201/250/347/267/232/345/210/206/343/201/256/344/272/244/345/267/256/345/210/244/345/256/232_collision_ray_circle_vs_line.rb +261 -0
- data/examples/00650_/345/206/206/343/201/250/347/202/271/343/201/256/345/217/215/345/260/204_collision_circle_vs_dot.rb +36 -0
- data/examples/00660_/345/206/206/343/201/250/345/206/206/343/201/250/347/267/232/345/210/206/343/201/256/345/217/215/345/260/204/343/203/207/343/203/242_collision_demo.rb +305 -0
- data/examples/00670_/343/203/251/343/202/244/343/203/225/343/202/262/343/203/274/343/203/240.rb +86 -0
- data/examples/00680_2/347/202/271/343/202/222/351/200/232/343/202/213/347/233/264/347/267/232/343/201/256/346/226/271/347/250/213/345/274/217.rb +81 -0
- data/examples/00690_/343/203/222/343/203/253/343/203/231/343/203/253/343/203/210/346/233/262/347/267/232.rb +77 -0
- data/examples/00700_/343/202/263/343/203/203/343/203/233/346/233/262/347/267/232.rb +79 -0
- data/examples/00710_/343/202/267/343/202/260/343/203/242/343/202/244/343/203/211/346/233/262/347/267/232.rb +40 -0
- data/examples/00720_/343/202/267/343/203/200/346/244/215/347/211/251.rb +44 -0
- data/examples/00730_/343/202/257/343/203/252/343/203/225/343/202/251/343/203/274/343/203/211/343/202/242/343/203/210/343/203/251/343/202/257/343/202/277_/345/237/272/346/234/254.rb +29 -0
- data/examples/00740_/343/202/257/343/203/252/343/203/225/343/202/251/343/203/274/343/203/211/343/202/242/343/203/210/343/203/251/343/202/257/343/202/277_/346/224/271/350/211/257_/350/211/262/344/273/230/343/201/215.rb +68 -0
- data/examples/00750_/343/202/257/343/203/252/343/203/225/343/202/251/343/203/274/343/203/211/343/202/242/343/203/210/343/203/251/343/202/257/343/202/277_/343/203/211/343/203/274/343/203/212/343/203/204/345/236/213.rb +44 -0
- data/examples/00760_/347/201/253/350/212/261.rb +42 -0
- data/examples/00770_atan/343/201/247atan2/343/202/222/346/233/270/343/201/217.rb +26 -0
- data/examples/00780_/346/250/231/346/272/226/343/203/251/343/202/244/343/203/226/343/203/251/343/203/252/343/201/256atan2_sin_cos/343/202/222/344/275/277/343/201/206.rb +15 -0
- data/examples/00790_/350/247/222/345/272/246/343/201/250/343/203/251/343/202/270/343/202/242/343/203/263/343/201/256/347/233/270/344/272/222/345/244/211/346/217/233.rb +22 -0
- data/examples/00800_/347/220/203/343/201/214/347/233/264/347/267/232/347/232/204/343/201/253/345/213/225/343/201/204/343/201/246/343/201/204/343/202/213/343/201/240/343/201/221/343/201/247/345/233/236/350/273/242/343/201/227/343/201/246/343/201/204/343/202/213/343/202/210/343/201/206/343/201/253/350/246/213/343/201/210/343/202/213.rb +27 -0
- data/examples/00810_/343/202/267/343/203/237/343/203/245/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263_/350/273/212.rb +75 -0
- data/examples/00820_/343/202/267/343/203/237/343/203/245/343/203/254/343/203/274/343/202/267/343/203/247/343/203/263_/346/210/246/350/273/212.rb +90 -0
- data/examples/00830_/350/247/222/345/272/246/345/267/256.rb +36 -0
- data/examples/00840_/346/224/276/347/211/251/347/267/232/343/201/247/347/213/231/346/222/203_/346/231/202/351/226/223/345/233/272/345/256/232.rb +61 -0
- data/examples/00850_/346/224/276/347/211/251/347/267/232/343/201/247/347/213/231/346/222/203_/350/247/222/345/272/246/345/233/272/345/256/232.rb +84 -0
- data/examples/00860_/346/224/276/347/211/251/347/267/232/343/201/247/347/213/231/346/222/203_/351/200/237/345/272/246/345/233/272/345/256/232.rb +66 -0
- data/examples/00870_/350/247/222/345/272/246/350/243/234/346/255/243_/345/212/240/351/200/237/343/203/237/343/202/265/343/202/244/343/203/253.rb +60 -0
- data/examples/00880_/345/210/235/351/200/237/343/201/214/351/200/237/343/201/204/343/203/237/343/202/265/343/202/244/343/203/253.rb +51 -0
- data/examples/00890_/346/255/243/350/246/217/344/271/261/346/225/260/343/201/250/346/250/231/346/272/226/345/201/217/345/267/256/343/201/256/345/217/257/350/246/226/345/214/226.rb +72 -0
- data/examples/00900_/345/220/221/345/277/203/345/212/233/343/201/247/345/233/236/350/273/242/343/200/220/350/247/222/345/272/2460/345/272/246/343/201/213/343/202/211/343/200/221.rb +23 -0
- data/examples/00910_/345/220/221/345/277/203/345/212/233/343/201/247/345/233/236/350/273/242/343/200/220/344/273/273/346/204/217/343/201/256/350/247/222/345/272/246/343/201/213/343/202/211/343/200/221.rb +33 -0
- data/examples/00920_/343/203/236/343/203/252/343/202/252/343/203/226/343/203/251/343/202/266/343/203/274/343/202/272/351/242/250/343/201/253/347/224/273/351/235/242/344/270/241/347/253/257/343/201/214/347/271/213/343/201/243/343/201/246/343/201/204/343/202/213/344/276/213.rb +29 -0
- data/examples/00930_/345/212/271/346/236/234/351/237/263.rb +17 -0
- data/examples/00940_/343/203/236/343/203/203/343/203/227/343/203/201/343/203/203/343/203/227/343/201/256/343/203/236/343/203/203/343/203/227/351/205/215/347/275/256.rb +71 -0
- data/examples/00950_/343/203/236/343/203/203/343/203/227/343/203/201/343/203/203/343/203/227/343/201/256/350/241/250/347/244/272/344/276/213.rb +28 -0
- data/examples/00960_/343/203/236/343/203/203/343/203/227/343/203/201/343/203/203/343/203/227/343/201/250/345/215/230/344/270/200/347/224/273/345/203/217/343/201/256/351/201/225/343/201/204/343/202/222/345/220/270/345/217/216/343/201/231/343/202/213/344/276/213.rb +47 -0
- data/examples/00970_observer_/343/201/235/343/201/2561_/347/233/264/346/216/245.rb +28 -0
- data/examples/00980_observer_/343/201/235/343/201/2562_/346/231/256/351/200/232/343/201/253Singleton/347/211/210.rb +30 -0
- data/examples/00990_observer_/343/201/235/343/201/2563_SimpleDelegator/347/211/210.rb +28 -0
- data/examples/01000_observer_/343/201/235/343/201/2564_/351/200/206/343/201/253/343/203/253/343/203/274/343/203/227/344/270/273/345/260/216.rb +28 -0
- data/examples/01010_observer_/343/201/235/343/201/2565_/343/201/204/343/202/215/343/202/223/343/201/252/346/211/200/343/201/213/343/202/211/345/221/274/343/202/223/343/201/247/343/201/204/343/202/213/343/201/221/343/201/251Singleton/343/201/252/343/201/256/343/201/247/345/256/211/345/205/250.rb +37 -0
- data/examples/01020_observer_/343/201/235/343/201/2566_/343/201/204/343/202/215/343/202/223/343/201/252/346/211/200/343/201/213/343/202/211/345/221/274/343/201/266/345/240/264/345/220/210callbacks/343/202/222/344/275/277/343/202/217/343/201/252/343/201/204/343/202/210/343/201/206/343/201/253.rb +30 -0
- data/examples/01030_observer_/343/201/235/343/201/2567_/343/202/250/343/203/225/343/202/247/343/202/257/343/203/210/343/202/277/343/202/271/343/202/257/343/202/222/345/233/236/343/201/231/344/276/213.rb +57 -0
- data/examples/01040_/343/203/236/343/202/246/343/202/271/343/201/256/344/275/215/347/275/256/343/201/253/343/203/224/343/202/257/343/202/273/343/203/253/343/202/222/346/211/223/343/201/244.rb +18 -0
- data/examples/01050_/343/203/224/343/202/257/343/202/273/343/203/253/345/205/250/344/275/223/343/202/222/346/233/270/343/201/215/350/276/274/343/202/200.rb +27 -0
- data/examples/01060_effect_/347/224/273/345/203/217/343/201/256/343/202/263/343/203/263/343/203/234/343/203/252/343/203/245/343/203/274/343/203/210/346/263/225/343/201/253/343/202/210/343/202/213/343/202/250/343/203/225/343/202/247/343/202/257/343/203/210/345/207/246/347/220/206.rb +116 -0
- data/examples/01070_effect_FF7/343/201/256/346/210/246/351/227/230/343/201/253/345/205/245/343/202/213/343/201/250/343/201/215/343/201/256/343/202/250/343/203/225/343/202/247/343/202/257/343/203/210.rb +33 -0
- data/examples/01080_effect_/350/203/214/346/231/257/343/202/222/347/267/251/343/201/217/346/266/210/343/201/227/343/201/246/343/201/204/343/201/217/343/201/250/343/202/271/343/203/240/343/203/274/343/202/272/343/201/253/343/201/252/343/202/213.rb +16 -0
- data/examples/01090_/347/224/273/345/203/217/343/201/256/343/202/257/343/203/255/343/202/271/343/203/225/343/202/247/343/203/274/343/203/211.rb +37 -0
- data/examples/01100_/343/202/271/343/202/257/343/203/252/343/203/274/343/203/263/346/203/205/345/240/261.rb +8 -0
- data/examples/01110_lib_contrib_menu.rb +19 -0
- data/examples/01120_/351/233/233/345/236/213_2P/345/257/276/346/210/246/351/242/250STG.rb +109 -0
- data/examples/01130_/351/233/233/345/236/213_/346/210/246/350/273/212/345/257/276/346/210/246.rb +396 -0
- data/examples/01140_/351/233/233/345/236/213_2P/345/257/276/346/210/246.rb +60 -0
- data/examples/01150_/351/233/233/345/236/213_/343/202/271/343/203/274/343/203/221/343/203/274/343/203/236/343/203/252/343/202/252/351/242/250/343/202/242/343/202/257/343/202/267/343/203/247/343/203/263.rb +1251 -0
- data/examples/01160_2D/343/202/242/343/203/225/343/202/243/343/203/263/345/244/211/346/217/233.rb +40 -0
- data/examples/01170_stackprof.rb +10 -0
- data/examples/01180_sdl_/343/202/242/343/203/253/343/203/225/343/202/241/343/203/226/343/203/254/343/203/263/343/203/207/343/202/243/343/203/263/343/202/260/343/201/247/351/207/215/343/201/255/345/220/210/343/201/233/345/241/227/343/202/212/346/275/260/343/201/227.rb +11 -0
- data/examples/01190_/343/203/221/343/203/274/343/203/206/343/202/243/343/202/257/343/203/253/345/220/214/345/243/253/343/201/247/344/270/255/345/244/256/343/201/253/345/220/221/343/201/213/343/201/206.rb +79 -0
- data/examples/01200_lib_OpenGL.rb +55 -0
- data/examples/bezier.rb +202 -0
- data/examples/cursor.rb +50 -0
- data/examples/helper.rb +38 -0
- data/examples/lifegame_patterns.rb +102 -0
- data/examples/movable_point.rb +64 -0
- data/examples/mtx33.rb +294 -0
- data/examples/setup.rb +5 -0
- data/examples/stage_infos.rb +1 -0
- data/examples/start.sh +2 -0
- data/examples/test_all.rb +5 -0
- data/examples/testgl.rb +228 -0
- data/examples/trash/__0060_shooting2.rb +37 -0
- data/examples/trash/__0090_collision_circle1.rb +50 -0
- data/examples/trash/__0125_circle_collision.rb +103 -0
- data/examples/trash/__0130_circle_collision2.rb +60 -0
- data/examples/trash/__0270_circle_cycle_shift.rb +29 -0
- data/examples/trash/__bullet_algos.rb +224 -0
- data/examples/trash/gunship.rb +39 -0
- data/examples//343/203/227/343/203/255/343/202/270/343/202/247/343/202/257/343/202/277/343/203/274/343/201/253/350/241/250/347/244/272/343/201/231/343/202/213/343/201/250/343/201/215.sh +2 -0
- data/lib/stylet.rb +1 -0
- data/lib/stylet/application_memory_record.rb +33 -0
- data/lib/stylet/audio.rb +455 -0
- data/lib/stylet/axis_support.rb +62 -0
- data/lib/stylet/base.rb +76 -0
- data/lib/stylet/callbacks.rb +62 -0
- data/lib/stylet/cli.rb +54 -0
- data/lib/stylet/collision_support.rb +56 -0
- data/lib/stylet/config.rb +39 -0
- data/lib/stylet/contrib/menu.rb +508 -0
- data/lib/stylet/contrib/shared_pad.rb +32 -0
- data/lib/stylet/contrib/sprity.rb +149 -0
- data/lib/stylet/core.rb +118 -0
- data/lib/stylet/cpu_stat.rb +58 -0
- data/lib/stylet/delegators.rb +54 -0
- data/lib/stylet/draw.rb +256 -0
- data/lib/stylet/draw_support/arrow.rb +56 -0
- data/lib/stylet/draw_support/circle.rb +63 -0
- data/lib/stylet/draw_support/polygon.rb +22 -0
- data/lib/stylet/font.rb +172 -0
- data/lib/stylet/fps_adjust.rb +23 -0
- data/lib/stylet/fps_stat.rb +41 -0
- data/lib/stylet/input.rb +8 -0
- data/lib/stylet/input/base.rb +105 -0
- data/lib/stylet/input/hardware_bindings.rb +65 -0
- data/lib/stylet/input/key_one.rb +162 -0
- data/lib/stylet/input/support.rb +72 -0
- data/lib/stylet/joystick.rb +31 -0
- data/lib/stylet/joystick_adapter.rb +130 -0
- data/lib/stylet/joystick_adapters/buffalo_snes_adapter.rb +47 -0
- data/lib/stylet/joystick_adapters/elecom_usb_pad_adapter.rb +30 -0
- data/lib/stylet/joystick_adapters/hori_rap_v3_sa_adapter.rb +46 -0
- data/lib/stylet/joystick_adapters/ps3_standard_adapter.rb +40 -0
- data/lib/stylet/joystick_adapters/unknown_adapter.rb +13 -0
- data/lib/stylet/keyboard.rb +15 -0
- data/lib/stylet/logger.rb +12 -0
- data/lib/stylet/mouse.rb +58 -0
- data/lib/stylet/palette.rb +17 -0
- data/lib/stylet/rect.rb +113 -0
- data/lib/stylet/shortcut.rb +8 -0
- data/lib/stylet/state.rb +87 -0
- data/lib/stylet/stylet.rb +44 -0
- data/lib/stylet/system_pause.rb +24 -0
- data/lib/stylet/version.rb +3 -0
- data/log/.gitkeep +0 -0
- data/stylet.gemspec +31 -0
- data/test/test_helper.rb +6 -0
- data/test/test_input_base.rb +12 -0
- data/test/test_input_key_one.rb +43 -0
- data/test/test_input_support.rb +47 -0
- data/test/test_sample.rb +13 -0
- data/test/test_state.rb +26 -0
- data/tips.org +16 -0
- metadata +391 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
#
|
2
|
+
# 再帰曲線 ヒルベルト曲線(アルゴリズム)
|
3
|
+
# http://www.softist.com/programming/hilbert/hilbert.htm
|
4
|
+
#
|
5
|
+
# ヒルベルト曲線 - Wikipedia
|
6
|
+
# http://ja.wikipedia.org/wiki/%E3%83%92%E3%83%AB%E3%83%99%E3%83%AB%E3%83%88%E6%9B%B2%E7%B7%9A#
|
7
|
+
# Hilbert curve は、フラクタル図形の一つで
|
8
|
+
# 空間を覆い尽くす空間充填曲線の一つ。ドイツの数学者ダフィット・ヒルベルトが1891年に考案した
|
9
|
+
#
|
10
|
+
require_relative "helper"
|
11
|
+
|
12
|
+
class App < Stylet::Base
|
13
|
+
include Helper::CursorWithObjectCollection
|
14
|
+
include Helper::MovablePoint
|
15
|
+
|
16
|
+
setup do
|
17
|
+
self.title = "ヒルベルト曲線"
|
18
|
+
@num = 4
|
19
|
+
@delta = 24
|
20
|
+
end
|
21
|
+
|
22
|
+
update do
|
23
|
+
@num += button.btA.repeat - button.btB.repeat
|
24
|
+
@delta += (button.btC.repeat - button.btD.repeat)
|
25
|
+
@current = vec2[srect.max_x - @delta, srect.min_y + @delta]
|
26
|
+
@before_point = @current.clone
|
27
|
+
ldr(@num)
|
28
|
+
|
29
|
+
vputs "num: #{@num}"
|
30
|
+
vputs "delta: #{@delta}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def line_to(x, y)
|
34
|
+
dir = vec2[x * @delta, y * @delta]
|
35
|
+
@current += dir
|
36
|
+
draw_line(@before_point, @current)
|
37
|
+
@before_point = @current.clone
|
38
|
+
end
|
39
|
+
|
40
|
+
def ldr(n)
|
41
|
+
if n > 0
|
42
|
+
dlu(n - 1); line_to(-1, 0) # ←
|
43
|
+
ldr(n - 1); line_to(0, 1) # ↓
|
44
|
+
ldr(n - 1); line_to(1, 0) # →
|
45
|
+
urd(n - 1)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def urd(n)
|
50
|
+
if n > 0
|
51
|
+
rul(n - 1); line_to(0, -1) # ↑
|
52
|
+
urd(n - 1); line_to(1, 0) # →
|
53
|
+
urd(n - 1); line_to(0, 1) # ↓
|
54
|
+
ldr(n - 1)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def rul(n)
|
59
|
+
if n > 0
|
60
|
+
urd(n - 1); line_to(1, 0) # →
|
61
|
+
rul(n - 1); line_to(0, -1) # ↑
|
62
|
+
rul(n - 1); line_to(-1, 0) # ←
|
63
|
+
dlu(n - 1)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def dlu(n)
|
68
|
+
if n > 0
|
69
|
+
ldr(n - 1); line_to(0, 1) # ↓
|
70
|
+
dlu(n - 1); line_to(-1, 0) # ←
|
71
|
+
dlu(n - 1); line_to(0, -1) # ↑
|
72
|
+
rul(n - 1)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
run
|
77
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#
|
2
|
+
# 再帰プログラムによるフラクタル図形の描画:CodeZine
|
3
|
+
# http://codezine.jp/article/detail/73
|
4
|
+
|
5
|
+
require_relative "helper"
|
6
|
+
|
7
|
+
class Koch < Stylet::Base
|
8
|
+
include Helper::CursorWithObjectCollection
|
9
|
+
include Helper::MovablePoint
|
10
|
+
|
11
|
+
setup do
|
12
|
+
@power = 3
|
13
|
+
@vertex_n = 15
|
14
|
+
end
|
15
|
+
|
16
|
+
update do
|
17
|
+
@power += button.btA.repeat - button.btB.repeat
|
18
|
+
@vertex_n += button.btC.repeat - button.btD.repeat
|
19
|
+
|
20
|
+
@vertex_n.times.each {|i|
|
21
|
+
get_pos = proc {|i|
|
22
|
+
a = (1.0 * frame_counter / (60 * 60)) + (1.0 / @vertex_n * i)
|
23
|
+
vec2.angle_at(a * 7, a * 8) * srect.h * 0.4
|
24
|
+
}
|
25
|
+
# draw_vector get_pos[i], :origin => srect.center
|
26
|
+
koch_draw(srect.center + get_pos[i], srect.center + get_pos[i.next], @power)
|
27
|
+
}
|
28
|
+
vputs "power: #{@power}"
|
29
|
+
vputs "vertex_n: #{@vertex_n}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def koch_draw(a, b, n)
|
33
|
+
c = vec2[
|
34
|
+
(2 * a.x + b.x) / 3,
|
35
|
+
(2 * a.y + b.y) / 3,
|
36
|
+
]
|
37
|
+
d = vec2[
|
38
|
+
(a.x + 2 * b.x) / 3,
|
39
|
+
(a.y + 2 * b.y) / 3,
|
40
|
+
]
|
41
|
+
xx = b.x - a.x
|
42
|
+
yy = -(b.y - a.y)
|
43
|
+
|
44
|
+
if xx.zero?
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
48
|
+
distance = Math.sqrt(xx * xx + yy * yy) / Math.sqrt(3)
|
49
|
+
|
50
|
+
if xx >= 0
|
51
|
+
# 右上がり
|
52
|
+
angle = Math.atan(yy / xx) + Math::PI / 6
|
53
|
+
e = vec2[
|
54
|
+
a.x + distance * Math.cos(angle),
|
55
|
+
a.y - distance * Math.sin(angle),
|
56
|
+
]
|
57
|
+
else
|
58
|
+
angle = Math.atan(yy / xx) - Math::PI / 6
|
59
|
+
e = vec2[
|
60
|
+
b.x + distance * Math.cos(angle),
|
61
|
+
b.y - distance * Math.sin(angle),
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
if n <= 0
|
66
|
+
draw_line(a, c)
|
67
|
+
draw_line(c, e)
|
68
|
+
draw_line(e, d)
|
69
|
+
draw_line(d, b)
|
70
|
+
else
|
71
|
+
koch_draw(a, c, n - 1)
|
72
|
+
koch_draw(c, e, n - 1)
|
73
|
+
koch_draw(e, d, n - 1)
|
74
|
+
koch_draw(d, b, n - 1)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
run
|
79
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# シグモイド関数 - Wikipedia
|
2
|
+
# http://ja.wikipedia.org/wiki/%E3%82%B7%E3%82%B0%E3%83%A2%E3%82%A4%E3%83%89%E9%96%A2%E6%95%B0
|
3
|
+
require_relative "helper"
|
4
|
+
|
5
|
+
class App < Stylet::Base
|
6
|
+
include Helper::CursorWithObjectCollection
|
7
|
+
include Helper::MovablePoint
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@points = []
|
11
|
+
@points << srect.center + vec2[-srect.w * 0.4, srect.h * 0.4]
|
12
|
+
@points << srect.center + vec2[srect.w * 0.4, -srect.h * 0.4]
|
13
|
+
@gain = 8 # 0で水平、8ぐらいでS時、マイナスなら反転
|
14
|
+
end
|
15
|
+
|
16
|
+
update do
|
17
|
+
update_movable_points(@points)
|
18
|
+
@points.each_with_index {|e, i|vputs("p#{i}", :vector => e)}
|
19
|
+
|
20
|
+
p0, p1 = *@points
|
21
|
+
if p0.x > p1.x # 動かしていて左から順に p1 p0 になってしまったときは p0 p1 となるように入れ替える
|
22
|
+
p1, p0 = *@points
|
23
|
+
end
|
24
|
+
n = p1.x - p0.x
|
25
|
+
n.to_i.times.each do |x|
|
26
|
+
y = -sigmoid(@gain, 2.0 / n * x - 1.0) * (p0.y - p1.y)
|
27
|
+
draw_dot(p0 + [x, y])
|
28
|
+
end
|
29
|
+
|
30
|
+
@gain += 0.1 * (button.btB.repeat - button.btC.repeat)
|
31
|
+
|
32
|
+
vputs "gain: #{@gain.round(1)}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def sigmoid(gain, x)
|
36
|
+
1.0 / (1.0 + Math.exp(-gain * x))
|
37
|
+
end
|
38
|
+
|
39
|
+
run
|
40
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# 参照
|
2
|
+
# 「プログラムでシダを描画する」を Ruby で描画する - Qiita
|
3
|
+
# http://qiita.com/quanon86/items/d96cbea02800f97156e7
|
4
|
+
|
5
|
+
require_relative "helper"
|
6
|
+
|
7
|
+
class App < Stylet::Base
|
8
|
+
include Helper::CursorWithObjectCollection
|
9
|
+
|
10
|
+
setup do
|
11
|
+
@n = 12
|
12
|
+
@w1x = -> x, y { 0.836 * x + 0.044 * y }
|
13
|
+
@w1y = -> x, y { -0.044 * x + 0.836 * y + 0.169 }
|
14
|
+
@w2x = -> x, y { -0.141 * x + 0.302 * y }
|
15
|
+
@w2y = -> x, y { 0.302 * x + 0.141 * y + 0.127 }
|
16
|
+
@w3x = -> x, y { 0.141 * x - 0.302 * y }
|
17
|
+
@w3y = -> x, y { 0.302 * x + 0.141 * y + 0.169 }
|
18
|
+
@w4x = -> x, y { 0 }
|
19
|
+
@w4y = -> x, y { 0.175337 * y }
|
20
|
+
end
|
21
|
+
|
22
|
+
update do
|
23
|
+
f = -> (k, x, y) do
|
24
|
+
if 0 < k
|
25
|
+
f.(k - 1, @w1x.(x, y), @w1y.(x, y))
|
26
|
+
f.(k - 1, @w2x.(x, y), @w2y.(x, y)) if rand < 0.3
|
27
|
+
f.(k - 1, @w3x.(x, y), @w3y.(x, y)) if rand < 0.3
|
28
|
+
f.(k - 1, @w4x.(x, y), @w4y.(x, y)) if rand < 0.3
|
29
|
+
else
|
30
|
+
xx = (x * 490 + srect.w * 0.5).to_i
|
31
|
+
yy = (srect.h - y * 490).to_i
|
32
|
+
draw_dot(vec2[xx, yy], :color => :green)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
-> k, x, y { f.(k, x, y) }.(@n, 0, 0)
|
37
|
+
|
38
|
+
@n += (button.btA.repeat_0or1 - button.btB.repeat_0or1).to_i
|
39
|
+
|
40
|
+
vputs "n: #{@n}"
|
41
|
+
end
|
42
|
+
|
43
|
+
run
|
44
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative "helper"
|
2
|
+
|
3
|
+
class App < Stylet::Base
|
4
|
+
setup do
|
5
|
+
@x = 1
|
6
|
+
@y = 1
|
7
|
+
|
8
|
+
@a = 1.88
|
9
|
+
@b = -1.7
|
10
|
+
@c = -0.43
|
11
|
+
@d = -0.74
|
12
|
+
end
|
13
|
+
|
14
|
+
update do
|
15
|
+
1000.times do
|
16
|
+
xn = Math.sin(@a * @y) - @c * Math.cos(@a * @x)
|
17
|
+
yn = Math.sin(@b * @x) - @d * Math.cos(@b * @y)
|
18
|
+
@x = xn
|
19
|
+
@y = yn
|
20
|
+
p0 = srect.center + [@x * srect.w * 0.2, @y * srect.h * 0.2]
|
21
|
+
draw_dot(p0)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def background_clear
|
26
|
+
end
|
27
|
+
|
28
|
+
run
|
29
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative "helper"
|
2
|
+
|
3
|
+
class App < Stylet::Base
|
4
|
+
include Helper::Cursor
|
5
|
+
|
6
|
+
setup do
|
7
|
+
SDL::Mouse.hide
|
8
|
+
@cursor.display = false
|
9
|
+
|
10
|
+
@x = 1.0
|
11
|
+
@y = 1.0
|
12
|
+
|
13
|
+
reset
|
14
|
+
|
15
|
+
# @test_var = 0
|
16
|
+
# @menu = Stylet::Menu::Basic.new(name: "[メニュー]", elements: [
|
17
|
+
# {name: "モード", safe_command: proc {}, :value => proc { @test_var }, :change => proc {|v| @test_var += v }},
|
18
|
+
# ])
|
19
|
+
end
|
20
|
+
|
21
|
+
update do
|
22
|
+
# @menu.update
|
23
|
+
|
24
|
+
if button.btD.trigger?
|
25
|
+
simple_background_clear
|
26
|
+
end
|
27
|
+
|
28
|
+
@b += (button.btA.repeat - button.btB.repeat) * 0.1
|
29
|
+
|
30
|
+
10000.times do
|
31
|
+
xn = Math.sin(@a * @y) - @c * Math.cos(@a * @x)
|
32
|
+
yn = Math.sin(@b * @x) - @d * Math.cos(@b * @y)
|
33
|
+
@x = xn
|
34
|
+
@y = yn
|
35
|
+
p0 = srect.center + [@x * srect.w * 0.3, @y * srect.h * 0.3]
|
36
|
+
|
37
|
+
case
|
38
|
+
when true
|
39
|
+
r, g, b = screen.get_rgb(screen[*p0])
|
40
|
+
r = Stylet::Chore.max_clamp(r + 4*1, 255)
|
41
|
+
g = Stylet::Chore.max_clamp(g + 4*1, 255)
|
42
|
+
b = Stylet::Chore.max_clamp(b + 4*4, 255)
|
43
|
+
screen[*p0] = screen.format.map_rgb(r, g, b)
|
44
|
+
when false
|
45
|
+
s = 1
|
46
|
+
screen.draw_filled_rect_alpha(p0.x-s, p0.y-s, s*2+1, s*2+1, [0, 255, 255], 16)
|
47
|
+
when false
|
48
|
+
screen.draw_filled_rect_alpha(p0.x, p0.y, 1, 1, [255, 255, 255], 128)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def background_clear
|
54
|
+
end
|
55
|
+
|
56
|
+
def system_infos
|
57
|
+
[]
|
58
|
+
end
|
59
|
+
|
60
|
+
def reset
|
61
|
+
@a = 1.88
|
62
|
+
@b = -1.7
|
63
|
+
@c = -0.43
|
64
|
+
@d = -0.74
|
65
|
+
end
|
66
|
+
|
67
|
+
run
|
68
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative "helper"
|
2
|
+
|
3
|
+
class App < Stylet::Base
|
4
|
+
include Helper::Cursor
|
5
|
+
|
6
|
+
setup do
|
7
|
+
SDL::Mouse.hide
|
8
|
+
@cursor.display = false
|
9
|
+
|
10
|
+
@x = 1.0
|
11
|
+
@y = 1.0
|
12
|
+
|
13
|
+
@a = 1.40
|
14
|
+
@b = 1.56
|
15
|
+
@c = 1.40
|
16
|
+
@d = -6.56
|
17
|
+
end
|
18
|
+
|
19
|
+
update do
|
20
|
+
10000.times do
|
21
|
+
xn = @d * Math.sin(@a * @x) - Math.sin(@b * @y)
|
22
|
+
yn = @c * Math.cos(@a * @x) + Math.cos(@b * @y)
|
23
|
+
|
24
|
+
@x = xn
|
25
|
+
@y = yn
|
26
|
+
p0 = srect.center + [@x * srect.w * 0.06, @y * srect.h * 0.12]
|
27
|
+
|
28
|
+
r, g, b = screen.get_rgb(screen[*p0])
|
29
|
+
r = Stylet::Chore.max_clamp(r + 4*1, 255)
|
30
|
+
g = Stylet::Chore.max_clamp(g + 4*3, 255)
|
31
|
+
b = Stylet::Chore.max_clamp(b + 4*2, 255)
|
32
|
+
screen[*p0] = screen.format.map_rgb(r, g, b)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def background_clear
|
37
|
+
end
|
38
|
+
|
39
|
+
def system_infos
|
40
|
+
[]
|
41
|
+
end
|
42
|
+
|
43
|
+
run
|
44
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
require_relative "helper"
|
3
|
+
|
4
|
+
class Bullet
|
5
|
+
include Stylet::Delegators
|
6
|
+
|
7
|
+
def initialize(point:, angle:, speed:, accel:)
|
8
|
+
@point = point
|
9
|
+
@angle = angle
|
10
|
+
@speed = speed
|
11
|
+
@accel = accel
|
12
|
+
@radius = 0
|
13
|
+
@p0 = @point
|
14
|
+
end
|
15
|
+
|
16
|
+
def update
|
17
|
+
@speed += @accel
|
18
|
+
@radius += @speed
|
19
|
+
@p1 = @point + vec2.angle_at(@angle) * @radius
|
20
|
+
draw_line(@p0, @p1)
|
21
|
+
@p0 = @p1
|
22
|
+
end
|
23
|
+
|
24
|
+
def screen_out?
|
25
|
+
@speed <= 0
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class App < Stylet::Base
|
30
|
+
include Helper::CursorWithObjectCollection
|
31
|
+
|
32
|
+
update do
|
33
|
+
if @button.btA.trigger?
|
34
|
+
n = 16
|
35
|
+
n.times.each do |i|
|
36
|
+
@objects << Bullet.new(:point => cursor.point.dup, :angle => 1.0 / n * i, :speed => rand(4.0..10.0), :accel => rand(-0.5 / 2..-0.3 / 2))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
run
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# atan で atan2 を書く
|
2
|
+
require_relative "helper"
|
3
|
+
|
4
|
+
class App < Stylet::Base
|
5
|
+
update do
|
6
|
+
vec = mouse.point - srect.center
|
7
|
+
vputs "vec: #{vec}"
|
8
|
+
x, y = *vec
|
9
|
+
|
10
|
+
v = Math.atan(y.to_f / x)
|
11
|
+
if x < 0
|
12
|
+
if y < 0
|
13
|
+
v -= Math::PI
|
14
|
+
else
|
15
|
+
v += Math::PI
|
16
|
+
end
|
17
|
+
end
|
18
|
+
vputs "atan: #{v}"
|
19
|
+
|
20
|
+
vputs "atan2: #{Math.atan2(y, x)}"
|
21
|
+
|
22
|
+
draw_vector(vec, :origin => srect.center)
|
23
|
+
end
|
24
|
+
|
25
|
+
run
|
26
|
+
end
|