lib/plane.rb in gmath3D-0.2.1 vs lib/plane.rb in gmath3D-0.2.2

- old
+ new

@@ -19,10 +19,27 @@ super() @base_point = base_point @normal = normal.normalize() end + def initialize_copy( original_obj ) + @base_point = original_obj.base_point.dup + @normal = original_obj.normal.dup + end + + # [Input] + # _rhs_ is Plane. + # [Output] + # return true if rhs equals myself. + def ==(rhs) + return false if rhs == nil + return false if( !rhs.kind_of?(Plane) ) + return false if( self.base_point != rhs.base_point) + return false if( self.normal != rhs.normal) + return true + end + def to_s "Plane[point#{@base_point.to_element_s}, normal#{@normal.to_element_s}]" end # This function returns closest distance between Line and anothor element. @@ -37,10 +54,9 @@ # [in case _target_ is FiniteLine] # return "distance, point on plane, point on target, parameter on target" # as [Numeric, Vector3, Vector3, Numeric]. # [in case _target_ is Plane] # return "distance, intersect line" as [Numeric, Vector3]. - def distance(target) # with Point if(target.kind_of?(Vector3)) return distance_to_point(target) #with Line