Pied et peau Ok
This commit is contained in:
parent
1a34ea5d07
commit
e56d064bba
|
@ -12,5 +12,18 @@ namespace Bonhomme02
|
|||
{
|
||||
class BaseBJ
|
||||
{
|
||||
Peau Haut, Millieux, Bas, parent;
|
||||
double angleHaut, angleMillieux, angleBas;
|
||||
public BaseBJ()
|
||||
{
|
||||
|
||||
}
|
||||
public BaseBJ(ref Peau parent, ref Peau bas, double epaisseur)
|
||||
{
|
||||
this.parent = parent;
|
||||
Bas = bas;
|
||||
angleHaut = angleMillieux = angleBas = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="BaseBJ.cs" />
|
||||
<Compile Include="BaseDessin.cs" />
|
||||
<Compile Include="Pied.cs" />
|
||||
<Compile Include="Vecteur.cs" />
|
||||
<Compile Include="Bonhomme.cs" />
|
||||
<Compile Include="Bras.cs" />
|
||||
|
|
|
@ -13,9 +13,11 @@ namespace Bonhomme02
|
|||
public partial class Form1 : Form
|
||||
{
|
||||
private Bonhomme bonhomme;
|
||||
private Peau test;
|
||||
private Peau jambe;
|
||||
private Pied pied;
|
||||
private BufferedGraphics bufferG = null;
|
||||
private Graphics g;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -50,8 +52,10 @@ namespace Bonhomme02
|
|||
|
||||
private void btnCreationCarrosse_Click(object sender, EventArgs e)
|
||||
{
|
||||
test = new Peau(this.TV, 80, 80, 10, 10, Math.PI/2);
|
||||
test.Afficher(this.TV.Handle);
|
||||
jambe = new Peau(this.TV, 80, 80, 50, 10, Math.PI/2);
|
||||
pied = new Pied(this.TV, ref jambe, 25, 10, Math.PI/8);
|
||||
jambe.Afficher(this.TV.Handle);
|
||||
pied.Afficher(this.TV.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ namespace Bonhomme02
|
|||
{
|
||||
class Peau : BaseDessin
|
||||
{
|
||||
Vecteur epaisseur;
|
||||
Vecteur longueur;
|
||||
public Vecteur epaisseur;
|
||||
public Vecteur longueur;
|
||||
public Peau parent = null;
|
||||
public Peau() : base()
|
||||
{
|
||||
|
||||
|
@ -29,6 +30,11 @@ namespace Bonhomme02
|
|||
{
|
||||
InitVecteurs(lg, ep, angle);
|
||||
}
|
||||
public Peau(PictureBox hebergeur, ref Peau parent, double lg, double ep, double angle) : base(hebergeur, parent.coordonnee.X, parent.coordonnee.Y)
|
||||
{
|
||||
this.parent = parent;
|
||||
InitVecteurs(lg, ep, angle);
|
||||
}
|
||||
public Peau(int x, int y) : base(x, y)
|
||||
{
|
||||
}
|
||||
|
@ -39,12 +45,47 @@ namespace Bonhomme02
|
|||
public Peau(PictureBox hebergeur, int x, int y, Color crayon) : base(hebergeur, x, y, crayon)
|
||||
{
|
||||
}
|
||||
|
||||
/*(0;0)
|
||||
* #---------------------------------------->x
|
||||
* | Coordonee
|
||||
* | CIG | CID
|
||||
* | #********#********#
|
||||
* | *<-------|------->*
|
||||
* | * -epai. |epaiseur*
|
||||
* | * l| *
|
||||
* | * o| *
|
||||
* | * n| *
|
||||
* | * g| *
|
||||
* | * u| *
|
||||
* | * e| *
|
||||
* | * u| *
|
||||
* | * r| *
|
||||
* | * \/ *
|
||||
* | #*****************#
|
||||
* | CSG CSD
|
||||
* |
|
||||
* \/
|
||||
* y
|
||||
*/
|
||||
#region accesseur
|
||||
public Point CIG{ get{ return base.coordonnee - epaisseur; }}
|
||||
public Point CID{ get{ return base.coordonnee + epaisseur; }}
|
||||
public Point CSG{ get{ return (base.coordonnee - epaisseur) + longueur; }}
|
||||
public Point CSD{ get{ return (base.coordonnee + epaisseur) + longueur; }}
|
||||
|
||||
public Point Coordonnee
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parent != null)
|
||||
{
|
||||
return parent.coordonnee+parent.longueur;
|
||||
}
|
||||
else
|
||||
return base.coordonnee;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Point CIG{ get{ return Coordonnee - epaisseur; }}
|
||||
public virtual Point CID{ get{ return Coordonnee + epaisseur; }}
|
||||
public virtual Point CSG{ get{ return (Coordonnee - epaisseur) + longueur; }}
|
||||
public virtual Point CSD{ get{ return (Coordonnee + epaisseur) + longueur; }}
|
||||
#endregion
|
||||
|
||||
#region methode
|
||||
|
@ -63,20 +104,11 @@ namespace Bonhomme02
|
|||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
|
||||
if (base.Remplir || 1==1)
|
||||
if (base.Remplir )
|
||||
{
|
||||
try
|
||||
{
|
||||
gr.FillPolygon(new SolidBrush(Color.Blue), l);
|
||||
//gr.FillPolygon
|
||||
gr.FillClosedCurve(new SolidBrush(Color.Blue), l);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
gr.DrawPolygon(new Pen(Brushes.Black), l);
|
||||
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -105,7 +137,7 @@ namespace Bonhomme02
|
|||
if (base.Visible && 1 == 1)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
|
||||
if (base.Remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(base.Fond), l);
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Bonhomme02
|
||||
{
|
||||
class Pied : Peau
|
||||
{
|
||||
/* |Jambe|
|
||||
* CIG | | CID
|
||||
* #---|-----|---------#
|
||||
* | | | | /\ | ------> & <------ = longuer
|
||||
* |<-----#----------->| \/ & /\ = epaisseur
|
||||
* | | | doigt est à 0 °R et Talon π °R ou 0 °R si la longueur est négative
|
||||
* #------#------------# doigt est la base
|
||||
* Talon doigt
|
||||
* CSG CSD
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Vecteur talon;
|
||||
public Pied() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Pied(PictureBox hebergeur) : base(hebergeur)
|
||||
{
|
||||
}
|
||||
|
||||
public Pied(PictureBox hebergeur, int xy) : base(hebergeur, xy)
|
||||
{
|
||||
}
|
||||
|
||||
public Pied(PictureBox hebergeur, int x, int y, double lg, double ep, double angle) : base(hebergeur, x, y, lg, ep, angle)
|
||||
{
|
||||
InitVecteurs(lg, ep, angle);
|
||||
}
|
||||
public Pied(PictureBox hebergeur, ref Peau parent, double lg, double ep, double angle) : base(hebergeur, parent.coordonnee.X, parent.Coordonnee.Y, lg, ep, angle)
|
||||
{
|
||||
base.parent = parent;
|
||||
talon = new Vecteur(lg , angle);
|
||||
InitVecteurs(lg, ep, angle);
|
||||
}
|
||||
public Pied(int x, int y) : base(x, y)
|
||||
{
|
||||
}
|
||||
public Pied(PictureBox hebergeur, int xy, Color crayon) : base(hebergeur, xy, crayon)
|
||||
{
|
||||
}
|
||||
|
||||
public Pied(PictureBox hebergeur, int x, int y, Color crayon) : base(hebergeur, x, y, crayon)
|
||||
{
|
||||
}
|
||||
|
||||
#region accesseur
|
||||
|
||||
public override Point CIG { get { return base.Coordonnee - talon + base.epaisseur; } }
|
||||
public override Point CID { get { return base.Coordonnee + base.longueur + base.epaisseur; } }
|
||||
public override Point CSG { get { return (base.Coordonnee - talon) - base.epaisseur; } }
|
||||
public override Point CSD { get { return (base.Coordonnee + base.longueur) - base.epaisseur; } }
|
||||
#endregion
|
||||
|
||||
#region methode
|
||||
private void InitVecteurs(double lg, double ep, double angle)
|
||||
{
|
||||
base.longueur = new Vecteur(lg, angle);
|
||||
base.epaisseur = new Vecteur(ep, ref base.longueur, true);
|
||||
|
||||
}
|
||||
|
||||
/* public override void Afficher(IntPtr handle)
|
||||
{
|
||||
if (base.Visible)
|
||||
{
|
||||
try
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
|
||||
if (base.Remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(Color.Blue), l);
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/*public override public void Afficher(IntPtr handle, float angle)
|
||||
{
|
||||
this.angleRotation = angle;
|
||||
if (visible)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CSG, CSD, CID, CIG };
|
||||
if (remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(fond), l);
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(contour, eppaisseurContour), l);
|
||||
}
|
||||
}*/
|
||||
/* public override void Cacher(IntPtr handle)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (base.Visible && 1 == 1)
|
||||
{
|
||||
Graphics gr = Graphics.FromHwnd(handle);
|
||||
Point[] l = new Point[4] { CIG, CID, CSD, CSG };
|
||||
if (base.Remplir)
|
||||
{
|
||||
gr.FillClosedCurve(new SolidBrush(base.Fond), l);
|
||||
}
|
||||
gr.DrawClosedCurve(new Pen(Brushes.Black), l);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}*/
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue