0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

windows11で、sketchup6 その108

Posted at

概要

windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
練習問題やってみた。

練習問題

アートな、作品を作れ。

写真

image.png

サンプルコード

class Kame2
	def fmod(a, b)
		x = (a / b).floor
		return a - b * x
	end
	def turn(a)
		@ANGLE = fmod(@ANGLE + a, 360.0)
	end
	def gmove(l)
		p = []
		rd = Math::PI / 180.0
		x = l * Math::cos(rd * @ANGLE)
		y = -l * Math::sin(rd * @ANGLE)
		px = @LX
		py = @LY
		p[p.length] = [px, py, 0]
		@LX += x
		@LY += y
		p[p.length] = [@LX, @LY, 0]
		p[p.length] = p[0]
		@entities.add_curve(p)
	end
	def koch(i)
		if (i <= 1)
			gmove(5)
			return
		end
		koch(i - 1)
		turn(-30)
		koch(i - 1)
		turn(120)
		koch(i - 1)
		turn(-30)
		koch(i - 1)
	end
	def initialize
		@ANGLE = 0;
		@LX = 10;
		@LY = 10;
		model = Sketchup.active_model
		@entities = model.active_entities
		koch(6)
	end
end







以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?