Skip to content

Commit

Permalink
Merge pull request #6 from Antoki/master
Browse files Browse the repository at this point in the history
New lpy Doc
  • Loading branch information
fredboudon authored Sep 3, 2019
2 parents c09964c + 672dc22 commit 982c242
Show file tree
Hide file tree
Showing 139 changed files with 1,737 additions and 252 deletions.
11 changes: 11 additions & 0 deletions doc/_downloads/Frame.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

Axiom: Frame

derivation length: 1
production:


interpretation:


endlsystem
32 changes: 32 additions & 0 deletions doc/_downloads/InterpolateColors.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#First Example

Step = 20
DIncr = 1.0 / Step

Axiom:
d = 0.0
for i in range(Step):
nproduce InterpolateColors(3, 5, d) F(2.0 / Step)
d += DIncr
produce ;(2) @O(0.15)

#Second Example

#Step = 4
#DIncr = 1.0 / Step

#Axiom:
# d = 0.0
# for i in range(Step):
# nproduce InterpolateColors(2, 6, d) F(2.0 /Step)
# d += DIncr
# produce ;(1) @O(0.15)

derivation length: 1
production:


interpretation:


endlsystem
21 changes: 21 additions & 0 deletions doc/_downloads/LineTo.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Axiom: LineTo(0,0,3)[LineTo(0,1,4)]LineTo(0,0,5)

Axiom: LineTo(0,0,3)[+(90)LineTo(0,1,4)]-(30)LineTo(0,0,5)

#Axiom: LineTo(0,0,2)[LineTo(0,1,3)Frame]LineTo(0,0,3)[LineTo(0,-1,4)Frame]LineTo(0,0,5)
#Same but change the turtle's orientation on the branches
#Axiom: LineTo(0,0,2)[OLineTo(0,1,3)Frame]LineTo(0,0,3)[OLineTo(0,-1,4)Frame]LineTo(0,0,5)

#The branch is created from (0,0,2) to (0,1,2)
#Axiom: LineTo(0,0,2)[LineTo(0,1,2)]LineTo(0,0,4)
#The branch is created from (0,0,2) to (0,0+1,2+2)
#Axiom: LineTo(0,0,2)[LineRel(0,1,2)]LineTo(0,0,4)

derivation length: 1
production:


interpretation:


endlsystem
13 changes: 13 additions & 0 deletions doc/_downloads/advancedRotations.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Axiom: Frame(2) | Frame(2)
#Axiom: Frame(2) UpReflexion Frame(2)
#Axiom: Frame(2) LeftReflexion Frame(2)
#Axiom: Frame(2) HeadingReflexion Frame(2)

derivation length: 1
production:


interpretation:


endlsystem
20 changes: 20 additions & 0 deletions doc/_downloads/basicShapes.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Draw a sphere of radius 1
Axiom: @O(1)
#Draw a circle of radius 1
#Axiom: @o(1)
#Draw a box of length 1
#Axiom: @B(1)
#Draw a quad of length 1
#Axiom: @b(1)

#Display some text
#Axiom: @L("This is some text", 18)

derivation length: 1
production:


interpretation:


endlsystem
17 changes: 17 additions & 0 deletions doc/_downloads/branching.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#Simple branching
Axiom: F(4)[+F(3)]F(4)
#More branches
#Axiom: F(4)[+F(2)[+F(1)]F(1)]F(3)[-F(1)]F(1)
#Visualizing the frames at different steps
#Axiom: Frame F(4)[+F(2)[+F(1)Frame]F(1)]FrameF(3)[-F(1)]F(1)
#Combined with other primitives
#Axiom: F(4)[+F(2)[+F(1);(3)@O(0.2)]F(1);(3)@O(0.2)]F(3)[-F(1);(3)@O(0.2)]F(1);(3)@O(0.2)

derivation length: 1
production:


interpretation:


endlsystem
12 changes: 12 additions & 0 deletions doc/_downloads/combined.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Axiom: F[;+~l]F[;-~l]F[;+~l]F[;-~l]F[;+~l]F[;-~l]F

#Axiom: ;@B(5),@O(0.5)_(0.5)F(3,0.5)_(0.2)@O(0.5)

derivation length: 1
production:


interpretation:


endlsystem
27 changes: 27 additions & 0 deletions doc/_downloads/filledPolygons.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#Drawing filled polygons

#Using f.
Axiom: Frame _(0.05),(2){.f(3).-(90)f(3).-(90)f(3).-(90)f(3)}
#Using F
#Axiom: Frame _(0.05),(2){.F(3)-(90)F(3)-(90)F(3)-(90)F(3)}
#With number of edges different than number of vertices
#Axiom: Frame _(0.05),(2){.F(3)-(90)F(3)-(90)F(3)}
#Not closed because the first . is missing
#Axiom: Frame _(0.05),(2){F(3)-(90)F(3)-(90)F(3)}

#Smart filling procedure

#Without smart procedure
#Axiom: _(0.01),(2) {.F+(95)F(0.7)-(120)F(0.2)+(80)F-(120)F(0.2)+(80)F(0.5)-120)F(0.5)+(80)F(0.2)-(120)F(0.5)+(150)F-(120)F(0.3)+(80)F -(120)F+(80)F(0.3)-(120)F +(150)F(0.5)-(120)F(0.2)+(80)F(0.5)-(120)F(0.5)+(80)F(0.2)-(120)F+(20)F(0.2)-(150)F(0.7)+(95)F}(False)

#With smart procedure
#Axiom: _(0.01),(2) {.F+(95)F(0.7)-(120)F(0.2)+(80)F-(120)F(0.2)+(80)F(0.5)-(120)F(0.5)+(80)F(0.2)-(120)F(0.5)+(150)F-(120)F(0.3)+(80)F -(120)F+(80)F(0.3)-(120)F +(150)F(0.5)-(120)F(0.2)+(80)F(0.5)-(120)F(0.5)+(80)F(0.2)-(120)F+(120)F(0.2)-(150)F(0.7)+(95)F}(True)

derivation length: 1
production:


interpretation:


endlsystem
14 changes: 14 additions & 0 deletions doc/_downloads/generalizedCylinders.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#Cylinders not generalized
Axiom: F(2)+(30)F+(30)F+(30)F+(45)F+(45)F@O

#Cylinders generalized
#Axiom: @GcF(2)+(30)F+(30)F+(30)F+(45)F+(45)F@O@Ge

derivation length: 1
production:


interpretation:


endlsystem
10 changes: 10 additions & 0 deletions doc/_downloads/harderExample.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Axiom: F[;-(70)f(0.1)\(80)~l]F[;+(70)f(0.1)/(80)~l][-F[;+(100)f(0.1)/(80)~l][F(1.2);@O(0.2)]-F(0.6)[-f(0.4);(3)@O(0.3)]F(0.6);@O(0.2)]F(1.5)[;+(70)f(0.1)/(70)~l]F(0.1)[+F;@O(0.2)]F;@O(0.2)

derivation length: 1
production:


interpretation:


endlsystem
14 changes: 14 additions & 0 deletions doc/_downloads/longPath.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#Equivalent to FF+(20)FF+(20)@D(0.8)FFF
Axiom: nF(2,1)+(20)nF(2,1)+(20)@D(0.8)nF(3,1)

#Branching shape
#Axiom: nF(2,1)[+(45)nF(2,1)]nF(1,1)[-(45)nF(2,1)]nF(2,1)

derivation length: 1
production:


interpretation:


endlsystem
20 changes: 20 additions & 0 deletions doc/_downloads/movement.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#MoveTo using coordinates
Axiom: @M(0,2,0) Frame

#MoveTo using a vector
#import numpy as np
#v = np.array([0,1,1])
#Axiom: MoveTo(v)

#MoveRel
#Axiom: F MoveTo(0,3,0) Frame
#Axiom: F MoveRel(0,3,0) Frame

derivation length: 1
production:


interpretation:


endlsystem
21 changes: 21 additions & 0 deletions doc/_downloads/orientation.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#Orient the turtle using coordinates
Axiom: Pinpoint(1,0,0) Frame
#Orient the turtle using a vector
#import numpy as np
#v = np.array([0,1,0])
#Axiom: Pinpoint(v) Frame
#Another example
#Axiom: Pinpoint(1,1,0) Frame

#PinpointRel
#Axiom: Frame MoveTo(0,2,0) Pinpoint(1,0,1) Frame
#Axiom: Frame MoveTo(0,2,0) PinpointRel(1,0,1) Frame

derivation length: 1
production:


interpretation:


endlsystem
18 changes: 18 additions & 0 deletions doc/_downloads/polygons.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#Basic method
Axiom: Frame(2)+(30)F(5)+(120)F(5)+(120)F(5)
#Procedural method
#Axiom: Frame(2)+F(5)+F(5)+F(5)+F(5)+F(5)+F(5)
# Or equivalently:
#Axiom:
# nproduce Frame(2)
# for i in range(6):
# nproduce +F(5)

derivation length: 1
production:


interpretation:


endlsystem
13 changes: 13 additions & 0 deletions doc/_downloads/resolution.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#low resolution
Axiom: SectionResolution(4) FFF@O(0.5)
#better resolution
#Axiom: SectionResolution(60) FFF@O(0.5)

derivation length: 1
production:


interpretation:


endlsystem
16 changes: 16 additions & 0 deletions doc/_downloads/rotation.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Different turtle rotations
Axiom: Frame(2) /(60) Frame(2)
#Axiom: Frame(2) \(60) Frame(2)
#Axiom: Frame(2) ^(60) Frame(2)
#Axiom: Frame(2) &(60) Frame(2)
#Axiom: Frame(2) +(60) Frame(2)
#Axiom: Frame(2) -(60) Frame(2)

derivation length: 1
production:


interpretation:


endlsystem
12 changes: 12 additions & 0 deletions doc/_downloads/scale.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Axiom: FF[-F[-F]F]FF

#Axiom: @D(2)FF[@Dd(1.5)-F[@Di(0.5)-F]F]FF

derivation length: 1
production:


interpretation:


endlsystem
10 changes: 10 additions & 0 deletions doc/_downloads/screen.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Axiom: Frame @2DF(0.6)@O(0.2)

derivation length: 1
production:


interpretation:


endlsystem
22 changes: 22 additions & 0 deletions doc/_downloads/setGuide1.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from openalea.plantgl.all import Polyline2D
from numpy import arange

def f(u):
return (u,u**2)

C0 = Polyline2D([f(u) for u in arange(0,1,0.1)]) # (B)

L = 10
#L = 6
#L = 15
L0 = 10
Axiom: SetGuide(C0,L0) nF(L, 0.1)

derivation length: 1
production:


interpretation:


endlsystem
31 changes: 31 additions & 0 deletions doc/_downloads/setGuide2.lpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
L = 10
#L = 6
#L = 15
L0 = 10
Axiom: Frame SetGuide(C0,L0) nF(L, 0.1)
#Axiom: Sweep(C0,C0,7,1)

derivation length: 1
production:


interpretation:


endlsystem
###### INITIALISATION ######

__lpy_code_version__ = 1.1

def __initialiseContext__(context):
import openalea.plantgl.all as pgl
C0 = pgl.BezierCurve2D(
pgl.Point3Array([(-0.5, 0, 1),(-0.171072, 0.38326, 1),(0.00367107, -0.317181, 1),(0.5, 0, 1)]) ,
)
C0.name = "C0"
panel_0 = ({'active': True, 'visible': True, 'name': 'Panel 1'},[('Curve2D',C0)])
parameterset = [panel_0,]
context["__functions__"] = []
context["__curves__"] = [('C0',C0),]
context["__parameterset__"] = parameterset
context["C0"] = C0
Loading

0 comments on commit 982c242

Please sign in to comment.