Class: VORuby::STC::V1_30::HalfspaceType

Inherits:
Object
  • Object
show all
Includes:
SerializableToXml
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

n area on the unit sphere defined by the intersection with a plane.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(vector, offset) ⇒ HalfspaceType

Returns a new instance of HalfspaceType.



5751
5752
5753
5754
# File 'lib/voruby/stc/1.30/stc.rb', line 5751

def initialize(vector, offset)
  self.vector = vector
  self.offset = offset
end

Instance Attribute Details

#offsetObject

Returns the value of attribute offset.



5749
5750
5751
# File 'lib/voruby/stc/1.30/stc.rb', line 5749

def offset
  @offset
end

#vectorObject

Returns the value of attribute vector.



5749
5750
5751
# File 'lib/voruby/stc/1.30/stc.rb', line 5749

def vector
  @vector
end

Class Method Details

.from_xml(xml) ⇒ Object



5796
5797
5798
5799
5800
5801
5802
5803
# File 'lib/voruby/stc/1.30/stc.rb', line 5796

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    Double3Type.from_xml(REXML::XPath.first(root, 'x:Vector', {'x' => obj_ns.uri})),
    HSOffsetType.from_xml(REXML::XPath.first(root, 'x:Offset', {'x' => obj_ns.uri}))
  )
end

Instance Method Details

#==(h) ⇒ Object



5777
5778
5779
5780
# File 'lib/voruby/stc/1.30/stc.rb', line 5777

def ==(h)
  self.vector == h.vector and
  self.offset == h.offset
end

#to_sObject



5792
5793
5794
# File 'lib/voruby/stc/1.30/stc.rb', line 5792

def to_s
  "#{self.vector} #{self.offset}"
end

#to_xml(name = nil) ⇒ Object



5782
5783
5784
5785
5786
5787
5788
5789
5790
# File 'lib/voruby/stc/1.30/stc.rb', line 5782

def to_xml(name=nil)
  el = element(name)
  
  el.add_element(self.vector.to_xml('Vector'))
  el.add_element(self.offset.to_xml('Offset'))
  
  collapse_namespaces(el)
  el
end