Etude (Learning of) des extension de Inkscape : cspsubdiv.py
Bonjour,
Je me suis lancé dans l'étude des extensions de Inkscape avec comme idée de créer mes propres extensions en rapport avec l'utilisation très particulière que je fais de ce logiciel.
I am learning how to create my own extentions for Inkscape and in this gaol, I learn the existing extentions. Actually, I learn cspsubdiv.py but I have several problems to understand how it run.
Actuellement, j'essaye de comprendre le fonctionnement de l'extension : cspsubdiv.py.
Voici le code complet de cette extension :
Here is the complete code of this extention :
#!/usr/bin/env python
from bezmisc import * # pour la fonction beziersplitatt()
from ffgeom import * # pour les fonctions Point(), Segment()
def maxdist(
p0 = Point(p0x,p0y)
p1 = Point(p1x,p1y)
p2 = Point(p2x,p2y)
p3 = Point(p3x,p3y)
s1 = Segment(p0,p3)
return max(s1.
def cspsubdiv(
for sp in csp:
def subdiv(
p0 = sp[i-1][1]
p1 = sp[i-1][2]
p2 = sp[i][0]
p3 = sp[i][1]
b = (p0,p1,p2,p3)
m = maxdist(b)
if m <= flat:
try:
except IndexError:
pass
else:
one, two = beziersplitatt(
sp[i-1][2] = one[1]
sp[i][0] = two[2]
p = [one[2]
sp[i:1] = [p]
Ce qui me pose problème ici :
What don't Y understand here :
Dans ces parties de code :
In this parts of the code :
1.
def maxdist(
p0 = Point(p0x,p0y)
p1 = Point(p1x,p1y)
p2 = Point(p2x,p2y)
p3 = Point(p3x,p3y)
==> Que sont ces quatre points passés en paramètre de la fonction ?
What are these four points passed as parameters to the function ?
2.
def cspsubdiv(
for sp in csp:
==> Qu'est que c'est cette variable "flat" ?
What is the variable "flat" ?
==> Que représente-t-elle ?
What does she represent ?
==> Comment est-elle passée à la fonction ?
How do we pass this variable to the function ?
Merci de m'aider à comprendre et désolé si mon anglais n'est pas très bon.
Thank you for your help and sorry for my bad english.
Question information
- Language:
- French Edit question
- Status:
- Solved
- For:
- Inkscape Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Papy Octet
- Solved:
- Last query:
- Last reply: