Class: DxfIO::Entity::Ellipse

Inherits:
Other
  • Object
show all
Defined in:
lib/dxf_io/entity/ellipse.rb

Constant Summary collapse

ADDITIONAL_GROUP_CODES =
{minor_to_major_ration: 40}.freeze

Constants inherited from Other

Other::END_POINT_GROUP_NUMS, Other::GROUP_CODES, Other::START_POINT_GROUP_NUMS, Other::TYPE_NAME_VALUE_MAPPING, Other::X_COORDINATE_GROUP_NUMS, Other::Y_COORDINATE_GROUP_NUMS, Other::Z_COORDINATE_GROUP_NUMS

Instance Method Summary collapse

Methods inherited from Other

#-, #bordering_xs, #bordering_ys, #frame?, #height, #left_down_point, #move_to!, #points, #to_a, #to_h, #width, #xs, #ys

Instance Method Details

#bordering_pointsObject



34
35
36
# File 'lib/dxf_io/entity/ellipse.rb', line 34

def bordering_points
  major_axis_points + minor_axis_points
end

#centerObject



14
15
16
# File 'lib/dxf_io/entity/ellipse.rb', line 14

def center
  points.find(&:start?)
end

#major_axis_endpoint_vectorObject



18
19
20
# File 'lib/dxf_io/entity/ellipse.rb', line 18

def major_axis_endpoint_vector
  points.find(&:end?)
end

#major_axis_pointsObject



26
27
28
# File 'lib/dxf_io/entity/ellipse.rb', line 26

def major_axis_points
  [center + major_axis_endpoint_vector, center + major_axis_endpoint_vector.rotate_180]
end

#minor_axis_endpoint_vectorObject



22
23
24
# File 'lib/dxf_io/entity/ellipse.rb', line 22

def minor_axis_endpoint_vector
  major_axis_endpoint_vector.rotate_90 * minor_to_major_ration
end

#minor_axis_pointsObject



30
31
32
# File 'lib/dxf_io/entity/ellipse.rb', line 30

def minor_axis_points
  [center + minor_axis_endpoint_vector, center + minor_axis_endpoint_vector.rotate_180]
end