Coder Social home page Coder Social logo

3d-dsl's Introduction

3D DSL

3次元空間上に線を描写するミニ言語。

text.txtにプログラムを書くことによって、3次元空間上に線が描写される。

移動命令

現在位置が(r, θ, y)であるとすると、

walk a b c

という命令を与えると、現在位置から直線を引きつつ新しい位置(r + a, θ + b, y + c)に移動する。

同様に、

move a b c

は線を引かずに移動のみ行う

walk sw a b c

は、walkと同様の移動を行うが、線を引く/引かないを切り替えながら移動する。

繰り返し命令

繰り返し命令は以下のように記述

repeat { 移動命令もしくは繰り返し命令 } 繰り返し回数

例として以下のようなプログラムになる。

repeat {
  walk sw 0.4 3.6 0
  move 0.4 3.6 1.0
} 40

サンプル

repeat {
  walk sw 0.4 3.6 0
  move 0.4 3.6 1.0
} 40

スクリーンショット 2021-01-22 9 36 03



move 200 0 -300
repeat {
  repeat {
    walk -0.025 1 5.2
    walk -0.025 1 -5.1
  } 1800
  repeat {
    walk 0.025 1 5.2
    walk 0.025 1 -5.1
  } 1800
} 2

スクリーンショット 2021-01-22 9 36 40



repeat {
  move 10 36 0
  repeat {
    walk 0 12 0
    walk 0 0 10
  } 60
  repeat {
    walk 0 -12 0
    walk 0 0 -10
  } 60
  move 0 0 5
} 10

スクリーンショット 2021-01-22 9 38 30

3d-dsl's People

Contributors

hir0o avatar

Watchers

 avatar

3d-dsl's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.