Strict Standards: Non-static method phpbb_feed_factory::init() should not be called statically in /home/jacius/rubygame/forums/feed.php on line 66
[phpBB Debug] PHP Notice: in file /feed.php on line 171: Cannot modify header information - headers already sent by (output started at /feed.php:66)
[phpBB Debug] PHP Notice: in file /feed.php on line 172: Cannot modify header information - headers already sent by (output started at /feed.php:66)
Rubygame Forums 2009-02-10T20:39:59+00:00 http://rubygame.org/forums/feed.php?f=5&t=6 2009-02-10T20:39:59+00:00 http://rubygame.org/forums/viewtopic.php?t=6&p=8#p8 <![CDATA[Thick line drawing code]]> draw_line_a method:

Code:
require 'ftor'
module Rubygame

  class Surface
    def draw_line_s(point1, point2, color, thickness)
      half_thickness = thickness/2.0
      x1 = point1[0]
      y1 = point1[1]
      x2 = point2[0]
      y2 = point2[1]

      point1_vector = Ftor.new x1, y1
      point2_vector = Ftor.new x2, y2

      line_vector = point2_vector-point1_vector
      perp_vector = line_vector.normal.unit

      points = []
      pvt = perp_vector*half_thickness
      poly_point1 = Ftor.new(x1,y1)+pvt
      poly_point2 = Ftor.new(x2,y2)+pvt
      poly_point3 = Ftor.new(x2,y2)-pvt
      poly_point4 = Ftor.new(x1,y1)-pvt

      points << [poly_point1.x,poly_point1.y]
      points << [poly_point2.x,poly_point2.y]
      points << [poly_point3.x,poly_point3.y]
      points << [poly_point4.x,poly_point4.y]
      points << [poly_point1.x,poly_point1.y]

      draw_polygon_s points, color
      draw_circle_s [x1,y1], half_thickness, color
      draw_circle_s [x2,y2], half_thickness, color
    end
  end

end # module Rubygame


Screen shot example: (thickness of 17)
Image

Statistics: Posted by shawn42 — Tue Feb 10, 2009 8:39 pm


]]>