|
using System;
using System .Collections .Generic;
using System .ComponentModel;
using System .Drawing;
using System .Drawing .Drawing2D;
using System .Windows .Forms;
using MoveGraphLibrary;
namespace GraphicalPrimitives
{
public class Hole
{
Shape m_shape;
PointF m_center;
float m_radius;
int nVertices;
double m_angle;
static float minRad = 10;
// -------------------------------------------------
public Hole (PointF ptC, float rad)
{
m_shape = Shape .Circle;
m_center = ptC;
m_radius = Math .Max (minRad, rad);
nVertices = 0;
m_angle = 0;
}
// -------------------------------------------------
public Hole (PointF ptC, float rad, int nPoints, double angleDegree)
{
switch (nPoints)
{
case 3:
default:
m_shape = Shape .Polyg_3;
nVertices = 3;
break;
case 4:
m_shape = Shape .Polyg_4;
nVertices = 4;
break;
case 5:
m_shape = Shape .Polyg_5;
nVertices = 5;
break;
case 6:
m_shape = Shape .Polyg_6;
nVertices = 6;
break;
case 7:
m_shape = Shape .Polyg_7;
nVertices = 7;
break;
case 8:
m_shape = Shape .Polyg_8;
nVertices = 8;
break;
}
m_center = ptC;
m_radius = Math .Max (minRad, rad);
nVertices = Math .Max (3, nPoints);
m_angle = Auxi_Convert .DegreeToRadian (angleDegree);
}
// ------------------------------------------------- Shape
public Shape Shape
{
get { return (m_shape); }
}
// ------------------------------------------------- Center
public PointF Center
{
get { return (m_center); }
set { m_center = value; }
}
// ------------------------------------------------- Radius
public float Radius
{
get { return (m_radius); }
}
// ------------------------------------------------- MinimumRadius
static public float MinimumRadius
{
get { return (minRad); }
}
// ------------------------------------------------- VerticesNumber
public int VerticesNumber
{
get { return (nVertices); }
}
// ------------------------------------------------- Angle
public double Angle
{
get { return (m_angle); }
}
// ------------------------------------------------- Vertices
public PointF [] Vertices
{
get { return ((m_shape == Shape .Circle) ? null : Auxi_Geometry .RegularPolygon (m_center, m_radius, nVertices, m_angle)); }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.