Skip to content

Commit

Permalink
TODO added
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Vartanov committed Nov 15, 2008
1 parent 89a290b commit f7e3fff
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ Already implemented algorithms


Coming up
=========
=========

* Does polygon contain given point?
* Is polygon convex?

* Do polygons intersect?

* Does polygon contain given point?

* Rectangular bounds of polygon

* Area of polygon
Expand Down
35 changes: 35 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
== Auxiliary features
* Methods requests tagging

If algorithm requires some state or property of object, it should be tagged.
Requirements should be checked before each method call (of course, info should
be cached due to computational complexity of algorithms).
Example:

class Polygon

def convex?
...
end

def self_intersecting?
...
end

must_be :convex
must_not_be :self_intersecting
def contains_point?(point)
... # code, which assumes, that polygon is convex and not self_intersecting
end

== Algorithms

* Polygon convexity
* Polygons intersection
* Polygon contains given point?
* Rectangular bounds of polygon
* Area of polygon
* Does circle contain given point?
* Do circles intersect?
* Area of circle
* Making a ruby gem
4 changes: 2 additions & 2 deletions lib/vector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def +(vector)
end

def -(vector)
self + vector * -1
self + (-1) * vector
end

def *(scalar)
Expand All @@ -43,7 +43,7 @@ def coerce(scalar)
if scalar.is_a?(Numeric)
[self, scalar]
else
raise ArgumentError, "Cannot coerce #{scalar.inspect}"
raise ArgumentError, "Vector: cannot coerce #{scalar.inspect}"
end
end
end
Expand Down

0 comments on commit f7e3fff

Please sign in to comment.