Mes débuts avec Asymptote

Tout ce qui concerne le langage Asymptote. Ce langage est utilisable sur le forum via les balises asy.
[participation réservée aux utilisateurs inscrits]
Règles du forum
Merci de soigner la rédaction de vos messages et de consulter ce sujet avant de poster. Pensez également à utiliser la fonction recherche du forum.
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Mes débuts avec Asymptote

Message non lu par Infophile »

Bonjour !

Première prise en main avec Asymptote, s'avère peu concluante :mrgreen:
Mais ça m'aura permis d'utiliser quelques commandes de bases !

Code : Tout sélectionner

import geometry;
import graph;
size(5cm);

path visage=(0.5,-0.3)..(0.2,-0.2)..(0,0)..(0,0.45)..(0,0.6)..(0,0.85)..(0.3,0.95)..(0.5,0.95)..(0.7,0.95)..(1,0.85)..(1,0.6)..(1,0.45)..(1,0)..(0.8,-0.2)..(0.5,-0.3)..cycle;
filldraw(visage,pink); // bon ok elle est un peu rondouillarde !
pair a=(0.5,0.5), b=(0.5,-0.5);
pen stylo1=red, stylo2=magenta;
path bouche=(0,0)..(0.1,0.05)..(0.3,0.15)..(0.5,0.10)..(0.7,0.15)..(0.9,0.05)..(1,0)..(1,0)..(0.9,-0.05)..(0.7,-0.15)..(0.5,-0.10)..(0.3,-0.15)..(0.1,-0.05)..(0,0)--cycle;
path bouche2=shift(0.15*dir(0))*scale(0.7)*bouche;
axialshade(bouche2,stylo1,a,stylo2,b); // un peu de rouge à lèvres
path levre=(0,0)..(0.5,-0.02)..(1,0);
draw(bouche2,linewidth(1)); // un coup de crayon
draw(shift(0.15*dir(0))*scale(0.7)*levre);

path nez=(0.5,0.4)..controls (1,0.4)..(0.5,0.4)..(0.35,0.45)..(0.25,0.41)..(0.4,0.55);
path nez2=shift(0.1*dir(-90))*shift(0.15*dir(0))*scale(0.7)*nez;
draw(nez2); // oui je sais elle a un gros pif mais c'était pas évident à faire :p
draw(reflect((0.5,0),(0.5,0.5))*nez2);
path trait=(0.4,0.55)..controls (0.4,0.6) and (0.4,1)..(0.38,1);
path trait2=shift(0.1*dir(-90))*shift(0.15*dir(0))*scale(0.7)*trait;
draw(trait2);
draw(reflect((0.5,0),(0.5,0.5))*trait2);

path oeil=(0.15,0.8)..controls (0.27,0.87) and (0.27,0.87)..(0.4,0.8);
draw(oeil);
path oeil2=reflect((0.15,0.8),(0.4,0.8))*oeil;
draw(oeil2,linewidth(1)); // un coup de crayon

path pupille=Circle((0.27,0.8),0.05);
pen stylo3=black, stylo4=royalblue;
pair c=(0.27,0.8), d=(0.73,0.8);
radialshade(pupille,stylo3,c,0.005,stylo4,c,0.05); // quel regard ! ^^
draw(pupille,linewidth(0.5));

path oeil3=reflect((0.5,0),(0.5,0.5))*oeil;
path oeil4=reflect((0.5,0),(0.5,0.5))*oeil2;
path pupille2=reflect((0.5,0),(0.5,0.5))*pupille;
draw(oeil3);
draw(oeil4,linewidth(1));
radialshade(pupille2,stylo3,d,0.005,stylo4,d,0.05);
draw(pupille2,linewidth(0.5));
D'ailleurs je me demandais, peut-on créer une structure "oeil" qui comprend le contour de l'oeil, la pupille, l'effet radiashade etc ? Et ensuite appliquer reflect sur cette structure ? Parce que là j'ai été obligé d'appliquer reflect à chacun de mes path c'est pas très pratique.

Autre chose, pour le pourtour de l'oeil j'ai utilisé deux path (contour supérieur et contour inférieur avec ricil), comment remplir en blanc la zone délimitée par ces deux path ? Je sais faire avec deux path cycle via la commande "^^" mais là non.

Merci ! :)
Pièces jointes
essai.jpg
essai.jpg (8.61 Kio) Consulté 2657 fois
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Joli.

Pour le pourtour de l'œil, tu peux essayer ça

Code : Tout sélectionner

path tour=buildcycle(oeil,oeil2);
fill(tour,white);
christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Apparemment ça ne fonctionne pas : "non cyclic path cannot be filled".

Dommage !
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Ah bon ? Chez moi ça fonctionne !

Et avec ça ?

Code : Tout sélectionner

path tour=oeil--oeil2--cycle;
fill(tour,white);
Christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Non plus c'est bizarre ! :?
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Infophile a écrit :Non plus c'est bizarre ! :?
En effet...

Bon et en remplaçant

Code : Tout sélectionner

path oeil2=reflect((0.15,0.8),(0.4,0.8))*oeil;
par

Code : Tout sélectionner

path oeil2=reflect((0.15,0.801),(0.4,0.801))*oeil;
puis avec

Code : Tout sélectionner

path tour=buildcycle(oeil,oeil2);
fill(tour,white);
Qu'est-ce que ça donne ?

Christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Même problème :?
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Alors là je comprends pas trop, tout fonctionne bien chez moi.

Code : Tout sélectionner

path tour=buildcycle(oeil,oeil2);
fill(tour,white);
pair[] inter=intersectionpoints(oeil,oeil2);
draw(inter[0],red+2bp);
draw(inter[1],red+2bp);
devrait faire apparaître les points d'intersection, s'il y en a. sinon essaye avec 0.802 .

Christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Bizarre, revoilà le code complet :

Code : Tout sélectionner

import geometry;
import graph;
size(5cm);

path visage=(0.5,-0.3)..(0.2,-0.2)..(0,0)..(0,0.45)..(0,0.6)..(0,0.85)..(0.3,0.95)..(0.5,0.95)..(0.7,0.95)..(1,0.85)..(1,0.6)..(1,0.45)..(1,0)..(0.8,-0.2)..(0.5,-0.3)..cycle;
filldraw(visage,pink);
pair a=(0.5,0.5), b=(0.5,-0.5);
pen stylo1=red, stylo2=magenta;
path bouche=(0,0)..(0.1,0.05)..(0.3,0.15)..(0.5,0.10)..(0.7,0.15)..(0.9,0.05)..(1,0)..(1,0)..(0.9,-0.05)..(0.7,-0.15)..(0.5,-0.10)..(0.3,-0.15)..(0.1,-0.05)..(0,0)--cycle;
path bouche2=shift(0.15*dir(0))*scale(0.7)*bouche;
axialshade(bouche2,stylo1,a,stylo2,b);
path levre=(0,0)..(0.5,-0.02)..(1,0);
draw(bouche2,linewidth(1));
draw(shift(0.15*dir(0))*scale(0.7)*levre);

path nez=(0.5,0.4)..controls (1,0.4)..(0.5,0.4)..(0.35,0.45)..(0.25,0.41)..(0.4,0.55);
path nez2=shift(0.1*dir(-90))*shift(0.15*dir(0))*scale(0.7)*nez;
draw(nez2);
draw(reflect((0.5,0),(0.5,0.5))*nez2);
path trait=(0.4,0.55)..controls (0.4,0.6) and (0.4,1)..(0.38,1);
path trait2=shift(0.1*dir(-90))*shift(0.15*dir(0))*scale(0.7)*trait;
draw(trait2);
draw(reflect((0.5,0),(0.5,0.5))*trait2);

path oeil=(0.15,0.8)..controls (0.27,0.87) and (0.27,0.87)..(0.4,0.8);
filldraw(oeil,white);
path oeil2=reflect((0.15,0.802),(0.4,0.802))*oeil;
draw(oeil2,linewidth(1)); // un p'tit coup de récil ^^
path tour=buildcycle(oeil,oeil2);
fill(tour,white);
pair[] inter=intersectionpoints(oeil,oeil2);
draw(inter[0],red+2bp);
draw(inter[1],red+2bp);

path pupille=Circle((0.27,0.8),0.05);
pen stylo3=black, stylo4=royalblue;
pair c=(0.27,0.8), d=(0.73,0.8);
radialshade(pupille,stylo3,c,0.005,stylo4,c,0.05);
draw(pupille,linewidth(0.5));

path oeil3=reflect((0.5,0),(0.5,0.5))*oeil;
path oeil4=reflect((0.5,0),(0.5,0.5))*oeil2;
path pupille2=reflect((0.5,0),(0.5,0.5))*pupille;
draw(oeil3);
draw(oeil4,linewidth(1));
radialshade(pupille2,stylo3,d,0.005,stylo4,d,0.05);
draw(pupille2,linewidth(0.5));
même message d'erreur.
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Ok...
ligne 26, ce n'est pas

Code : Tout sélectionner

filldraw(oeil,white);
mais

Code : Tout sélectionner

draw(oeil);
:wink:

Christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

oups oui ! ça marche merci ! une idée pour les "structures" ?

edit : en fait il me semble que ce que je demande correspond plutôt à frame/picture.
Dernière modification par Infophile le samedi 08 mai 2010, 22:17, modifié 1 fois.
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Infophile a écrit :une idée pour les "structures" ?
Désolé, je ne me suis pas encore penché sur la question. Tu peux essayer d'aller voir .

Christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Tiens est-que vous savez comment avoir la même coloration syntaxique que sur le site ? Je la trouve très claire !
chellier
Modérateur honoraire
Modérateur honoraire
Messages : 355
Inscription : samedi 25 juillet 2009, 12:25
Localisation : Le Creusot
Contact :

Re: Mes débuts avec Asymptote

Message non lu par chellier »

Infophile a écrit :Tiens est-que vous savez comment avoir la même coloration syntaxique que sur le site ? Je la trouve très claire !
Encore désolé, il faut demander à son auteur. Pas mal d'éditeur commencent à avoir une coloration syntaxique pour Asymptote : GEdit pour linux, Notepad++ pour windows et probablement d'autres encore...

Christophe
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

J'ai enregistré ce code sous format XML dans Notepad++ (que j'ai trouvé dans un autre fil par GMaths, qui me semble est l'auteur de ces exemples) :

Code : Tout sélectionner

<NotepadPlus>
    <UserLang name="Asy" ext="asy">
        <Settings>
            <Global caseIgnored="no" />
            <TreatAsSymbol comment="yes" commentLine="yes" />
            <Prefix words1="yes" words2="yes" words3="yes" words4="yes" />
        </Settings>
        <KeywordLists>
            <Keywords name="Delimiters">"&apos;0"&apos;0</Keywords>
            <Keywords name="Folder+">{</Keywords>
            <Keywords name="Folder-">}</Keywords>
            <Keywords name="Operators">&apos; - ! " ( ) , . ; ? @ [ ] < > =</Keywords>
            <Keywords name="Comment">1/* 2*/ 0//</Keywords>
            <Keywords name="Words1">and controls tension atleast curl if else while for do return break continue struct typedef new access import unravel from include quote static public private restricted this explicit true false null cycle newframe operator</Keywords>
            <Keywords name="Words2">Braid Label Legend Rmf TreeNode arrowhead binarytree binarytreeNode block bool bool3 bounds coord cputime file filltype frame grid3 guide horner hsv indexedTransform int key line linefit marginT marker object pair path path3 pen picture position projection real revolution scaleT scientific segment side slice splitface string surface tensionSpecifier ticklocate ticksgridT tickvalues transform transformation tree triple vertex void</Keywords>
            <Keywords name="Words3">AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks J Label Landscape Left LeftRight LeftTicks Legend Linear Link Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OutTicks Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade Rainbow Range Relative Right RightTicks Rotate Round Scale ScaleX ScaleY ScaleZ Seascape Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _cputime _draw _eval _image _labelpath _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc add addArrow addSaveFunction addseg adjust alias align all angle animate annotate apply arc arcarrowsize arcdir arclength arcpoint arctime array arrow arrow2 arrowbase arrowbasepoints arrowsize asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit attach atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bar barmarksize barsize basealign baseline bbox beep beginclip begingroup beginpoint bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binput bins bispline blend boutput box breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor case1 case2 case3 cbrt cd ceil center change2 checkSegment checkconditionlength checker checklengths checkposition checktriangle circle circlebarframe circlemarkradius clamped clear clip close cmyk code colatitude collect color colorless colors colorspace comma complement concat cone conj connect containmentTree contains contour contour3 controlSpecifier convert copy cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc csv cubicroots curlSpecifier currentarrow currentexitfunction currentmomarrow curve cut cutafter cutbefore cyclic cylinder debugger deconstruct defaultdir defaultformat defaultpen defaultspline degrees delete deletepreamble determinant diagonal diamond diffdiv dimension dir dirSpecifier dirtime display divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawtick duplicate ellipse embed embed3 empty enclose endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erf erfc error errorbar errorbars euler eval exit exitXasyMode exitfunction exp expi expm1 extend extension fabs fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite firstcut fit fixedscaling floor flush fmdefaults fmod font fontcommand fontsize format frac frequency fspline gamma generate_random_backtrace generateticks getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hsv hyperlink hypot identity image incircle increasing incrementposition indexedTransform initXasyMode initdefaults input insert inside interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections inverse invisible is3D isDuplicate italic item key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout leastsquares legend legenditem length lift limits line linear linecap linejoin lineskip linetype linewidth link list locale locatefile location log log10 logaxiscoverage longitude lookup makeNode makedraw makepen map margin markangle markangleradius markanglespace marker markinterval marknodes markuniform math max max3 maxbound maxcoords maxratio maxtimes mean midpoint min min3 minbound minipage minratio mintimes momArrowPath momarrowsize monotonic nativeformat natural needshipout newl newpage newslide newton newtree nextpage nib none normalvideo notaknot numberpage nurb object offset opacity orientation outformat outline outprefix output overwrite pack pairs palette partialsum path path3 pattern pause pdf periodic perpendicular phantom photon piecewisestraight point polar polargraph polygon postcontrol postscript pow10 prc prc0 precision precontrol prepend print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radius rand randompath read1 read2 read3 readline realmult rectangle rectangular rectify reflect relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rfind rgb rgba rgbint rmf rms rotate rotation round roundbox roundedpath roundrectangle sample save savedefaults saveline scale scale3 scaleT scaleless scientific search searchtree sec secondaryX secondaryY seconds section seek seekeof segment sequence setpens sgn shift shiftless shipout shipout3 side simpson sin single sinh size size3 skewness skip slant sleep slope slopefield solve sort sourceline sphere split sqrt square srand startScript stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile strokepath subdivide subitem subpath substr sum surface system tab tableau tan tangent tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose triangulate tridiagonal trim truepoint tube uncycle unfill uniform unit unitrand unitsize unityroot unstraighten upcase updatefunction upscale uptodate usepackage usersetting usleep value variance variancebiased vbox vectorfield verbatim view windingnumber word write xaxis xaxis3 xaxis3At xaxisAt xequals xinput xlimits xoutput xpart xscale xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans</Keywords>
            <Keywords name="Words4">AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Draw E ENE ESE Emerald EndPoint Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki Label Lavender LavenderBlush LawnGreen LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RawSienna Red RedOrange RedViolet Rhodamine RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange align allowstepping animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet camerafactor chartreuse circlemarkradiusfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength count cputimeformat crossmarksizefactor currentpatterns currentpen currentpicture currentposition currentprojection cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultS defaultbackpen defaultfilename defaultformat defaultpen diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down eps epsilon evenodd extendcap fermionpen figureborder figuremattpen firstnode firststep foregroundcolor fuchsia gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hwratio identity4 ignore inXasyMode inch inches includegraphicscommand incommensurate inf infinity institutionpen intMax intMin invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow linemargin longdashdotted longdashed magenta markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nomarker nopoint noprimary nullpath nullpen oldbulletcolor olive orange overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow perpfactor phi photonamplitude photonpen photonratio pi pink plain plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportsize white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="FF0000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="FF0000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="FF8040" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="800000" bgColor="FFFFFF" fontName="Courier New" fontStyle="5" fontSize="10" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="004080" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="FF0000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="C0C0C0" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="C0C0C0" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="D9006C" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="008040" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="AF2BFF" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="AF2BFF" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
        </Styles>
    </UserLang>
</NotepadPlus>
Mais quand j'ouvre Notepad++ je n'ai pas cette coloration, si Gaetan passe par là... :)
GMaths
Utilisateur chevronné
Utilisateur chevronné
Messages : 2042
Inscription : lundi 01 octobre 2007, 10:20

Re: Mes débuts avec Asymptote

Message non lu par GMaths »

Infophile a écrit :Mais quand j'ouvre Notepad++ je n'ai pas cette coloration, si Gaetan passe par là... :)
Je passe par là ... pour dire qu'effectivement, j'utilise deux colorations différentes pour notepad++ et pour le site (dont le système de coloration n'a rien à voir avec celui de notepad++)

Pour la dernière version du xml cité : Notepad++ : coloration syntaxique pour Asymptote

... et pour proposer une version totalement revue de la jolie tête.
Je n'ai préservé que deux ou trois bricoles. :lol:

Code : Tout sélectionner

import geometry;
import graph;
size(5cm);

// Définitions
transform soy=reflect(S,N), sox=reflect(W,E);
path visage=(0,-3){dir(0)}..(3,-2)..(5,0)..(5,4.5)..(5,6)..(5,8.5)..(2,9.5)..{dir(180)}(0,9.5),
     visage=visage--soy*reverse(visage)--cycle;
path bouche=(5,0)..(4,-0.5)..(2,-1.5)..(0,-1)..(-2,-1.5)..(-4,-0.5)..(-5,0),
     bouche=bouche--sox*reverse(bouche)--cycle;
     bouche=scale(0.7)*bouche;
path levre=scale(0.7)*((-5,0)..(0,-0.2)..(5,0));
path nez=(0,4){dir(0)}..(1.5,4.5)..(2.5,4.1)..(1,5.5)
     --(1,5.5)..controls (1,6) and (1,10)..(1.2,10);
     nez=reverse(nez)--soy*nez;
     nez=shift((0,-1))*scale(0.7)*nez;
picture fr; unitsize(fr,1cm);
real alpha=48;
path oeil=(-.5,0){dir(alpha)}..{dir(-alpha)}(.5,0){dir(-180+alpha)}..{dir(180-alpha)}cycle,
     pupille=Circle((0,0),.25);
pen  stylo1=red, stylo2=magenta, stylo3=black, stylo4=royalblue;

// Tracés
filldraw(visage,pink);
axialshade(bouche,stylo1,(0,5),stylo2,(0,-5)); // intérêt ??
draw(bouche,linewidth(1)); draw(levre);
draw(nez);

fill(fr,oeil,white);
radialshade(fr,pupille,stylo3,(0,0),0,stylo4,(0,0),0.3);
clip(fr,oeil);
draw(fr,subpath(oeil,0,1),black); draw(fr,subpath(oeil,1,2),1bp+black);
add(fr.fit(),(-2,8)); add(fr.fit(),(2,8));
Il y avait trop de coordonnées redondantes et trop de nombres à virgule pour moi : je ne pouvais pas proposer une solution pour l'oeil sans retoucher le reste. ;-)
Pendant que j'y étais, j'ai tout recentré sur l'axe des ordonnées.
Dernière modification par GMaths le samedi 14 janvier 2012, 14:07, modifié 1 fois.
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Ah oui c'est beaucoup mieux niveau syntaxe ! Je vais m'en imprégner.

J'ai enregistré le fichier UserDefineLang dans notepad++ mais je suis pas sûr que la coloration que j'ai actuellement y corresponde, car je suis toujours en "normal text" quand j'ouvre notepad++. Sinon j'ai trouvé dans langage > Asy je sais pas si c'est pour asymptote mais je trouve la coloration moins jolie que sur le site :
Pièces jointes
assy.jpg
GMaths
Utilisateur chevronné
Utilisateur chevronné
Messages : 2042
Inscription : lundi 01 octobre 2007, 10:20

Re: Mes débuts avec Asymptote

Message non lu par GMaths »

Infophile a écrit :Ah oui c'est beaucoup mieux niveau syntaxe ! Je vais m'en imprégner.
Si tu remplaces

Code : Tout sélectionner

real alpha=48;
path oeil=(-.5,0){dir(alpha)}..{dir(-alpha)}(.5,0){dir(-180+alpha)}..{dir(180-alpha)}cycle,
par

Code : Tout sélectionner

real alpha=48, beta=48;
path oeil=(-.5,0){dir(alpha)}..{dir(-alpha)}(.5,0){dir(-180+beta)}..{dir(180-beta)}cycle,
tu pourras jouer sur alpha pour fermer plus ou moins les yeux.
Infophile a écrit :je trouve la coloration moins jolie que sur le site :
Les goûts et les couleurs... :D

A toi de jouer dans le fichier XML que tu cites pour modifier les couleurs.

Il y a aussi la possibilité de choisir les couleurs (du style personnalisé, qui peut-être asy) via les menus de Notepad++ mais alors il va retoucher le XML correspondant comme bon lui semble.
Infophile
Utilisateur éprouvé
Utilisateur éprouvé
Messages : 145
Inscription : dimanche 17 mai 2009, 12:29

Re: Mes débuts avec Asymptote

Message non lu par Infophile »

Il est vivant ! :)
Pièces jointes
youpi2.gif
youpi2.gif (56.65 Kio) Consulté 2413 fois
GMaths
Utilisateur chevronné
Utilisateur chevronné
Messages : 2042
Inscription : lundi 01 octobre 2007, 10:20

Re: Mes débuts avec Asymptote

Message non lu par GMaths »

GMaths a écrit :
Infophile a écrit :je trouve la coloration moins jolie que sur le site :
Les goûts et les couleurs... :D

A toi de jouer dans le fichier XML que tu cites pour modifier les couleurs.

Il y a aussi la possibilité de choisir les couleurs (du style personnalisé, qui peut-être asy) via les menus de Notepad++ mais alors il va retoucher le XML correspondant comme bon lui semble.
Un petit coup de pouce : sur la page dont les couleurs t'intéressent... clic-droit, tu demandes le code de la page où tu récupères le nom du css pour visualiser son contenu...
et donc tu pourras y lire notamment :

Code : Tout sélectionner

.builtin {
  /* font-lock-builtin-face */
  color: yellow;
  /* font-weight: bold; */
}
.comment {
  /* font-lock-comment-face */
  color: #6f6faf;
}
.comment-delimiter {
  /* font-lock-comment-delimiter-face */
  color: #6f6faf;
}
.constant {
  /* font-lock-constant-face */
  color: #99ccff;
}
.function-name {
  /* font-lock-function-name-face */
  color: #ffffff;
  /* font-weight: bold; */
}
.keyword {
  /* font-lock-keyword-face */
  color: #00ffff;
}
.string {
  /* font-lock-string-face */
  color: #ffa07a;
}
.type {
  /* font-lock-type-face */
  color: #ff0055;
  /* font-weight: bold;*/
}
.variable-name {
    /* font-lock-variable-name-face */
    color: #eedd82;
}
pour y récupérer les couleurs utiles.
Répondre