예제 #1
0
파일: cone.py 프로젝트: gferreira/zdogpy
    def __init__(self, **kwargs):

        if 'length' in kwargs:
            self.length = kwargs['length']

        Ellipse.__init__(self, **kwargs)

        # composite shape, create child shapes
        self.apex = Anchor(
            addTo=self,
            translate={'z': self.length},
        )

        # vectors used for calculation
        self.renderApex = Vector()
        self.tangentA = Vector()
        self.tangentB = Vector()

        self.surfacePathCommands = [
            # points set in renderConeSurface
            PathCommand('move', [{}], None),
            PathCommand('line', [{}], None),
            PathCommand('line', [{}], None),
        ]
예제 #2
0
from zDogPy.illustration import Illustration
from zDogPy.anchor import Anchor
from zDogPy.ellipse import Ellipse
from zDogPy.shape import Shape

I = Illustration()
I.setSize(200, 200)

orange   = '#E62'
eggplant = '#636'

# read transform from attribute and set anchor
anchorOptions = { 'addTo': I }

anchor = Anchor(**anchorOptions)

# circle
Ellipse(
    addTo=anchor,
    diameter=80,
    translate={ 'z' : -40 },
    stroke=20,
    color=eggplant,
)

# triangle
Shape(
    addTo=anchor,
    path=[
        { 'x' :   0, 'y' : -32 },
        { 'x' :  32, 'y' :  32 },
예제 #3
0
from zDogPy.shape import Shape
from zDogPy.illustration import Illustration
from zDogPy.box import Box

# colors
yellow = '#ED0'
gold = '#EA0'
orange = '#E62'
garnet = '#C25'
eggplant = '#636'

I = Illustration()
I.color = '#FDB'
I.setSize(120, 120)

model = Anchor(addTo=I, rotate=TAU / 8)

D = 20

boxOptions = {
    'addTo': model,
    'stroke': 1,
    'fill': True,
    'color': (1, 0, 0, 0.5),
    'width': D,
    'height': D,
    'depth': D,
    'topFace': yellow,
    'rearFace': gold,
    'leftFace': orange,
    'rightFace': orange,
예제 #4
0
# import zDogPy.shape
# reload(zDogPy.shape)

from zDogPy.boilerplate import TAU
from zDogPy.anchor import Anchor
from zDogPy.vector import Vector
from zDogPy.shape import Shape
from zDogPy.illustration import Illustration

I = Illustration()
I.setSize(24, 24)

D = 5
S = 3

origin = Anchor(addTo=I, scale=3)
dotOptions = dict(addTo=origin, stroke=S, color=(1, 0, 0, 0.5))

# Shape(translate={ 'x':  0, 'y' :  0, 'z':  0 }, **dotOptions)

Shape(translate={ 'x':  D, 'y' :  D, 'z':  D }, **dotOptions)
Shape(translate={ 'x': -D, 'y' :  D, 'z':  D }, **dotOptions)
Shape(translate={ 'x':  D, 'y' : -D, 'z':  D }, **dotOptions)
Shape(translate={ 'x': -D, 'y' : -D, 'z':  D }, **dotOptions)

Shape(translate={ 'x':  0, 'y' :  D, 'z':  D }, **dotOptions)
Shape(translate={ 'x':  0, 'y' : -D, 'z':  D }, **dotOptions)
Shape(translate={ 'x':  0, 'y' :  D, 'z': -D }, **dotOptions)
Shape(translate={ 'x':  0, 'y' : -D, 'z': -D }, **dotOptions)

Shape(translate={ 'x':  D, 'y' :  D, 'z': -D }, **dotOptions)
예제 #5
0
from zDogPy.boilerplate import TAU
from zDogPy.illustration import Illustration
from zDogPy.anchor import Anchor
from zDogPy.hemisphere import Hemisphere

yellow = '#ED0'
gold = '#EA0'
orange = '#E62'
garnet = '#C25'

I = Illustration()
I.setSize(400, 400)

burger = Anchor(
    addTo=I,
    translate={'y': 0},
)

hemisphere = Hemisphere(
    addTo=burger,
    diameter=100,
    translate={
        'x': 70,
        'y': 10,
        'z': 24
    },
    stroke=5,
    fill=False,
    color=orange,
)
예제 #6
0
eggplant = '#636'
garnet = '#C25'
orange = '#E62'
gold = '#EA0'
yellow = '#ED0'

I = Illustration()
I.setSize(sceneSize, sceneSize)

solids = []

hourglass = Anchor(
    addTo=I,
    translate={
        'x': 0,
        'y': -4
    },
)
solids.append(hourglass)

hemi = Hemisphere(
    addTo=hourglass,
    diameter=2,
    translate={'z': -1},
    color=garnet,
    backface=orange,
    stroke=True,
)
# # hemi.copy(
# #     translate={ 'z': 1 },
예제 #7
0
파일: burger.py 프로젝트: gferreira/zdogpy
from zDogPy.illustration import Illustration
from zDogPy.anchor import Anchor
from zDogPy.rect import Rect
from zDogPy.ellipse import Ellipse
from zDogPy.hemisphere import Hemisphere
from zDogPy.cylinder import Cylinder

yellow = '#ED0'
gold = '#EA0'
orange = '#E62'
garnet = '#C25'

I = Illustration()
I.setSize(400, 400)

burger = Anchor(addTo=I, translate={'y': 0}, rotate={'x': TAU / 4})

topBun = Hemisphere(addTo=burger,
                    diameter=96,
                    translate={'z': 0},
                    stroke=14,
                    fill=True,
                    color=orange)

cheese = Rect(addTo=burger,
              width=92,
              height=92,
              translate={'z': 25},
              stroke=16,
              color=yellow,
              fill=True)