# Thread: August/September Entry: Portolan Chart

1. ## August/September Entry: Portolan Chart

I'm trying a Portolan Chart: http://en.wikipedia.org/wiki/Portolan_chart

So far I've vectorized, cleaned up, and tweaked the base image in Inkscape, and written a little program to generate the web of Rhumb Lines.

### LATEST WIP ###

2. Cleaned up extraneous rhumb lines and rotated them slightly, and added a neatline.

### LATEST WIP ###

3. hello you... any chance you`d share that little rhumb program?? me wants it very bad!

4. Originally Posted by sigurdbjohansson
hello you... any chance you`d share that little rhumb program?? me wants it very bad!
Code:
```#!/usr/bin/ruby1.9.1

require 'matrix'

p=4

n=2**p

d1=600
d2=4*d1

points=Array.new(n) do |k|
theta=2*Math::PI*k/n

x=d1*Math.cos(theta)
y=d1*Math.sin(theta)

Vector[x,y]
end

def line(p1,p2,style)
"<path d=\"M#{p1.to_a.join " "} L#{p2.to_a.join " "}\" style=\"#{style}\" />"
end

puts <<EOS
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg version="1.1"
xmlns="http://www.w3.org/2000/svg">
EOS

n.times do |k|
p1=points[k]
(k...n).each do |l|#<path d="M250 150 L150 350 L350 350 Z" />
style=(k+l)%2==0? "stroke:black;stroke-width:0.5px;":"stroke:red;stroke-width:0.5px;"

opacity="opacity:#{rand*0.5+0.5}"
p2=points[l]
v=p1-p2
v=v*d2*(1.0/v.r)
p3=p1+v
p4=p2-v

# p4 - p2 - p1 - p3

print line(p1, p2, style+opacity)

print line(p4, p2, style+opacity)

puts line(p1, p3, style+opacity)

end
style="stroke:black;stroke-width:0.5px;"

theta=2*Math::PI*(k+n/4)/n

x=d2*Math.cos(theta)
y=d2*Math.sin(theta)

v=Vector[x,y]

p2=p1+v
p3=p1-v

opacity="opacity:#{rand*0.5+0.5}"

print line(p1, p2, style+opacity)
puts line(p1, p3, style+opacity)

end

puts "</svg>"```

5. thank you very much.

now i just need to know how to make all this code work?? heh heh..... where do i use it?? (total n00b, yes)

6. Originally Posted by sigurdbjohansson
thank you very much.

now i just need to know how to make all this code work?? heh heh..... where do i use it?? (total n00b, yes)

Well, you need a Ruby runtime to run it: http://www.ruby-lang.org/en/

If it's easier, here's the SVG file output, zipped because the forum software refuses to allow SVG files. With the program you can change the number of directions, but most real portolans seem to have 16 directions.

7. I`m sorry, but i haven`t got a clue here!
Where do I use the SVG file?? I tried it in Firefox, but I only got some of the image (three stars in the upper left corner)...
Is there somewhere in the code I can change the amount of "stars"?

8. AHA! I`m such a dumbass! You just copy and rotate the things??

But is there anyway I can get the image bigger than in my browserwindow??

9. Originally Posted by sigurdbjohansson
AHA! I`m such a dumbass! You just copy and rotate the things??
You should be able to load it into any vector graphics program like Inkscape, Corel Draw, Adobe Illustrator, or Xara X. Then you can move it around, scale it, delete lines, etc.

10. Thanks alot! I think I`ve got the hang of it now....

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•