Class: TransformedShape

Inherits:
Shape
  • Object
show all
Defined in:
lib/rcad.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Shape

#*, #+, #-, #align, #back, #bbox, #bottom, #center, #cx, #cy, #cz, #extrude, #front, #left, #maxx, #maxy, #maxz, #minx, #miny, #minz, #mirror_x, #mirror_y, #mirror_z, #move_x, #move_y, #move_z, #render, #revolve, #right, #rot_x, #rot_y, #rot_z, #scale_x, #scale_y, #scale_z, #top, #xcenter, #xsize, #ycenter, #ysize, #zcenter, #zsize, #~@

Constructor Details

#initialize(shape, trsf) ⇒ TransformedShape

Returns a new instance of TransformedShape.



372
373
374
375
# File 'lib/rcad.rb', line 372

def initialize(shape, trsf)
  @shape = shape
  @trsf = trsf
end

Instance Attribute Details

#shapeObject (readonly)

Returns the value of attribute shape.



370
371
372
# File 'lib/rcad.rb', line 370

def shape
  @shape
end

#trsfObject (readonly)

Returns the value of attribute trsf.



370
371
372
# File 'lib/rcad.rb', line 370

def trsf
  @trsf
end

Instance Method Details

#mirror(x, y, z) ⇒ Object



397
398
399
# File 'lib/rcad.rb', line 397

def mirror(x, y, z)
  TransformedShape.new(@shape, @trsf.mirror(x, y, z))
end

#move(x, y, z) ⇒ Object



385
386
387
# File 'lib/rcad.rb', line 385

def move(x, y, z)
  TransformedShape.new(@shape, @trsf.move(x, y, z))
end

#rotate(angle, axis) ⇒ Object



389
390
391
# File 'lib/rcad.rb', line 389

def rotate(angle, axis)
  TransformedShape.new(@shape, @trsf.rotate(angle, axis))
end

#scale(x, y, z) ⇒ Object



393
394
395
# File 'lib/rcad.rb', line 393

def scale(x, y, z)
  TransformedShape.new(@shape, @trsf.scale(x, y, z))
end

#to_sObject



377
378
379
# File 'lib/rcad.rb', line 377

def to_s
  sprintf("%s*%s", @trsf, @shape)
end

#transform(trsf) ⇒ Object



381
382
383
# File 'lib/rcad.rb', line 381

def transform(trsf)
  TransformedShape.new(@shape, trsf * @trsf)
end