The assignment of the week was to play around with 2D and 3D drawings.
For the 2D part i decided to “code a picture” with python. After some search on the internet i found a very cool and easy to use python library, written on top of a famous C library named Cairo. ( https://cairographics.org/ ). The python library im talking about is https://github.com/Zulko/gizeh . The requirements to install Gizeh are:
Python: i already had it but you can find an how to guide here http://www.python.it/
Gizeh: clone the archive from GitHub, unzip it, navigate to the unzipped directory and run sudo python setup.py install
. Gizeh will also install Cairo and Numpy
FYI: Numpy is a powerful library mainly used for linear algebra and stuff.
The mathematical equation of a clockwise spiral is:
x = r * cos(t)
y = r * sin(t)
Where:
t is the angle
r is A + B * t
A and B are numbers you can play with to change the shape of the spiral
x = 0 y = 0 old_x = 500 old_y = 500 angle = 0.0 delta_x = 0.2 # A delta_y = 0.2 # B maxPoints = [x * 0.1 for x in range(0, 390)] for i in maxPoints: theta = delta_y * i angle = delta_x * math.exp(theta) x = angle * math.cos(i) + 500 y = angle * math.sin(i) + 500 line = gizeh.polyline(points=[(x,y), (old_x,old_y)], stroke_width=1, stroke=(0,0,0)) line.draw(surface) old_x = x old_y = y surface.get_npimage() surface.write_to_png("output.png")
The equation is:
x = r * cos(t)
y = r * sin(t)
Where:
t is the angle
r = A + e ^ (B * t)
A and B are numbers you can play with to change the shape of the spiral
import gizeh import math surface = gizeh.Surface(width=1000, height=1000) # in pixels x = 0 y = 0 old_x = 500 old_y = 500 angle = 0.0 delta_x = 0.2 delta_y = 0.2 maxPoints = [x * 0.1 for x in range(0, 390)] for i in maxPoints: theta = delta_y * i angle = delta_x * math.exp(theta) x = angle * math.cos(i) + 500 y = angle * math.sin(i) + 500 line = gizeh.polyline(points=[(x,y), (old_x,old_y)], stroke_width=1, stroke=(0,0,0)) line.draw(surface) old_x = x old_y = y surface.get_npimage() surface.write_to_png("output.png")
I'm not going to explain the story behind my logo because there isn't any, i just tried an unconventional way of making 2D drawings.
import gizeh import math pi = 3.14 a1 = -20 * float((pi/180.0)) a2 = 20 * float((pi/180.0)) a3 = 70.0 * float((pi/180.0)) a4 = 110.0 * float((pi/180.0)) surface = gizeh.Surface(width=300, height=300) icon = gizeh.Group([ gizeh.circle(r=140, xy=(150,150), fill=(0,0,0)), gizeh.circle(r=136, xy=(150,150), fill=((191/float(255)),(252/float(255)),(255/float(255)))), #ballrobot gizeh.circle(r=80, xy=(150,150), fill=(0,0,0)), gizeh.circle(r=78, xy=(150,150), fill=(1,1,1)), gizeh.arc(238, a1, a2, fill = (0,0,0), xy = [-75,150]), gizeh.arc(230, a1, a2, fill = (1,1,1), xy = [-70,150]), gizeh.arc(238, a3, a4, fill = (0,0,0), xy = [150,-70]), gizeh.arc(230, a3, a4, fill = (1,1,1), xy = [150,-64]), ]) icon.draw(surface) surface.get_npimage() surface.write_to_png("output.png")
I installed Inkscape which is a free, open-surce and cross platform vector graphics editor. In order to install Inkscape on MacOSX 10.12.1 ( Sierra ) i had to download and install XQuartz. After rebooting my pc i finally installed Inkscape.
I had some basic knowledge of Adobe Illustrator so wasn't difficult for me to get through Inkscape.
I tried to design a sphere and add some prospective light/shadow to it
My 3D modelling background rely mostly on Dassault Systemes SolidWorks. I’ve been using it for the last 5 years mainly for mechanical modelling. For the Fab Academy i decided to try out Rhinoceros because, i think, it fills what SolidWorks lacks: Complex Surface Modelling.
I had a student license for the windows version of Rhino, so i downloaded the installer from https://www.rhino3d.com/ and installed it.
The interface is very messy and full of small icons. To have a better user experience i had to scale down the screen resolution from 2.560 x 1.600 to 1600 x 1000.
I tried to model a sphere with a 3D texture wrapped around it:
I created a sphere with the sphere tool and placed it on the rhino's grid.
After i created a plane and a square base truncated pyramid, with the function array i created a matrix of pyramids 30 x 30 onto the plane i previously created.
With the function FlowOnSurf i wrapped the sphere with the plane of pyramids.
As you can see on the first image the 3D texture point to the wrong direction. To fix it i used the command Dir to flip the normal direction of the base plane.
During this week i had the chance to try out software i’ve always heard but never tried.
I think inkscape is a great tool, it’s free and i guess with some effort you can have the same result as with an expensive software like Adobe Illustrator but it's not “famous” in the working environment and maybe some employers might consider it unprofessional.
I think i’ll keep using Adobe Illustrator because i already have a great knowledge of it and i can access a free student license.
On the other hand i found Rhinoceros a very interesting tool, able to create complex shapes in a very fast way ( hard tho ). I hope to have the chance, in the future, to attend a Rhino class because i think, with the solidworks knowledge i already have, it complete my 3D modelling circle.