Class RS::Geometry::RSPoint
In: rsil/geometry/rspoint.rb
Parent: RS::Geometry::RSTripel
RSTripel RSRectangle RSObjcWrapper RSImageUnit RSImageList RSILRMagickConverter RSILTkConverter RSConverter RSProperties RSImageProperties RSPoint RSDimension Array RSVector RSFilter RSColor RSImage\n[rsil/extension/rsimageextension.rb\nrsil/graphics/rsimage.rb] RSImageX Comparable RSAbstractConverter Enumerable Test::Unit::TestCase RSTestPoint RSTestFilter RSTestImage RSTestExtension RSTestDimension RSTestVector RSTestImageUnit RSTestImageProperties RSTestColor RSTestRectangle RSTestProperties RSTestImageList RSTestConverter RSTestComparison RSTestStress RSTestUseCases RSTestTripel RSTestScenarios MonitorMixin Benchmark StandardError Assertion RSEXIFProperties RSTests rsil/geometry/rsdimension.rb rsil/geometry/rspoint.rb rsil/geometry/rsvector.rb rsil/geometry/rsrectangle.rb rsil/geometry/rstripel.rb Geometry rsil/graphics/rsfilter.rb rsil/graphics/rsimagelist.rb rsil/graphics/rscolor.rb rsil/graphics/rsimageunit.rb rsil/extension/rsimagex.rb rsil/graphics/rsimage.rb Graphics rsil/converter/rsconverter.rb rsil/converter/rsabstractconverter.rb rsil/converter/rsiltkconverter.rb rsil/converter/rsilrmagickconverter.rb Converter rsil/test/rstestusecases.rb rsil/test/rstestcolor.rb rsil/test/rstestdimension.rb rsil/test/rstestfilter.rb rsil/test/rstestpoint.rb rsil/test/rstestconverter.rb rsil/test/rstestimagelist.rb rsil/test/rstestimageproperties.rb rsil/test/rstestscenarios.rb rsil/test/rstestvector.rb rsil/test/rstesttripel.rb rsil/test/rstestproperties.rb rsil/test/rstestimageunit.rb rsil/test/rstestextension.rb rsil/test/rstestimage.rb rsil/test/rsteststress.rb rsil/test/rstestcomparison.rb rsil/test/rstestrectangle.rb rsil/test/rstests.rb Test rsil/extension/rsextension.rb Extension rsil/utils/rsimageproperties.rb rsil/utils/rsobjcwrapper.rb rsil/utils/rsproperties.rb rsil/utils/rsexifproperties.rb Utils RS Module: RS

Class:RSPoint
File:rspoint.rb
Purpose:RSPoint represents points with three values: x, y, z. It is used within RSRectangle.
Created by:Mario Pehle, 2006/04/28
Required modules:-
Offers functions:-

Methods

as_dimension   as_dimension   is_valid?   is_valid?   new   x   x=   y   y=   z   z=  

Constants

DEFAULT_VALUE = 0.0   when one of the three possible attributes is not provided to initialize, this value will be taken.

Public Class methods

Description:Creates a RSDimensiion out of the values of a given RSPoint.
Precondition:-
Postcondition:-
Exceptions:-
Uses:RS::Geometry::RSDimension#new
Returns:RSDimension if valid parameter, else nil
Parameters:Name | i/o/io | default | Meaning
:point | i | - | RSPoint, the source point

[Source]

    # File rsil/geometry/rspoint.rb, line 47
47:   def self::as_dimension point
48:     if point.kind_of? RS::Geometry::RSTripel
49:       return RS::Geometry::RSDimension.new(
50:         point.at(0),
51:         point.at(1),
52:         point.at(2)
53:       )
54:     end
55:     nil
56:   end
Description:Checks an object whether it is a valid argument for this class.
Precondition:-
Postcondition:-
Exceptions:-
Uses:-
Returns:true if valid, else false
Parameters:Name | i/o/io | default | Meaning
:value | i | - | Object, the object to check

[Source]

    # File rsil/geometry/rspoint.rb, line 93
93:   def self::is_valid? value
94:     return false if value.nil? or !value.respond_to?(:to_f)
95:     true
96:   end
Description:Creates a RSPoint.
Precondition:-
Postcondition:Created object has three values, accessable via RSPoint#[].
Exceptions:ArgumentError
Uses:RSPoint#is_valid?
Returns:RSPoint
Parameters:Name | i/o/io | default | Meaning
:x | i | DEFAULT_VALUE | Float, the value for x
:y | i | DEFAULT_VALUE | Float, the value for y
:z | i | DEFAULT_VALUE | Float, the value for z

[Source]

     # File rsil/geometry/rspoint.rb, line 130
130:   def initialize x=DEFAULT_VALUE, y=DEFAULT_VALUE, z=DEFAULT_VALUE
131:     unless self.is_valid?(x) or self.is_valid?(y) or self.is_valid?(z)
132:       raise ArgumentError, "Can not convert arguemnts."
133:     else
134:       super
135:     end
136:     self
137:   end

Public Instance methods

Description:Creates a RSDimension out of the values of a given RSPoint. If no point is given, the method returns the actual RSPoint as a RSDimension.
Precondition:-
Postcondition:-
Exceptions:-
Uses:RS::Geometry::RSDimension#new
Returns:RSDimension if valid parameter, else nil
Parameters:Name | i/o/io | default | Meaning
:point | i | nil | RSPoint, the source point

[Source]

    # File rsil/geometry/rspoint.rb, line 71
71:   def as_dimension point=nil
72:     if point.nil?
73:       return RS::Geometry::RSDimension.new(self.at(0), self.at(1), self.at(2))
74:     else
75:       return self.class.as_dimension(point)
76:     end
77:     nil
78:   end
Description:Checks an object whether it is a valid argument for this class.
Precondition:-
Postcondition:-
Exceptions:-
Uses:RSPoint#is_valid?
Returns:true if valid, else false
Parameters:Name | i/o/io | default | Meaning
:value | i | - | Object, the object to check

[Source]

     # File rsil/geometry/rspoint.rb, line 111
111:   def is_valid? value
112:     self.class.is_valid? value
113:   end
Description:Determines the x value of the point.
Precondition:-
Postcondition:-
Exceptions:-
Uses:RSPoint#[]
Returns:Float
Parameters:Name | i/o/io | default | Meaning

[Source]

     # File rsil/geometry/rspoint.rb, line 151
151:   def x
152:     self.at(0)
153:   end
Description:Sets the x value of the point.
Precondition:-
Postcondition:Value for x is changed.
Exceptions:-
Uses:RSPoint#[]
Returns:value if valid, else nil
Parameters:Name | i/o/io | default | Meaning
:value | i | - | Float, the value to set

[Source]

     # File rsil/geometry/rspoint.rb, line 200
200:   def x= value
201:     return self[0] = value.to_f if self.is_valid? value
202:     nil
203:   end
Description:Determines the y value of the point.
Precondition:-
Postcondition:-
Exceptions:-
Uses:RSPoint#[]
Returns:Float
Parameters:Name | i/o/io | default | Meaning

[Source]

     # File rsil/geometry/rspoint.rb, line 167
167:   def y
168:     self.at(1)
169:   end
Description:Sets the y value of the point.
Precondition:-
Postcondition:Value for y is changed.
Exceptions:-
Uses:RSPoint#[]
Returns:value if valid, else nil
Parameters:Name | i/o/io | default | Meaning
:value | i | - | Float, the value to set

[Source]

     # File rsil/geometry/rspoint.rb, line 218
218:   def y= value
219:     return self[1] = value.to_f if self.is_valid? value
220:     nil
221:   end
Description:Determines the z value of the point.
Precondition:-
Postcondition:-
Exceptions:-
Uses:RSPoint#[]
Returns:Float
Parameters:Name | i/o/io | default | Meaning

[Source]

     # File rsil/geometry/rspoint.rb, line 183
183:   def z
184:     self.at(2)
185:   end
Description:Sets the z value of the point.
Precondition:-
Postcondition:Value for z is changed.
Exceptions:-
Uses:RSPoint#[]
Returns:value if valid, else nil
Parameters:Name | i/o/io | default | Meaning
:value | i | - | Float, the value to set

[Source]

     # File rsil/geometry/rspoint.rb, line 236
236:   def z= value
237:     return self[2] = value.to_f if self.is_valid? value
238:     nil
239:   end

[Validate]