本文整理汇总了C#中PointF类的典型用法代码示例。如果您正苦于以下问题:C# PointF类的具体用法?C# PointF怎么用?C# PointF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointF类属于命名空间,在下文中一共展示了PointF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteDefaultFaceCalculation
public static void WriteDefaultFaceCalculation(PointF[] shape)
{
var calculatedFaceAlignment = GetFaceCalculationsFromShape(shape);
using (var db = new GrimacizerContext(GrimacizerContext.ConnectionString))
{
var faceCalculations = db.FaceCalculations.FirstOrDefault();
faceCalculations._0_TamplaStanga = calculatedFaceAlignment._0_TamplaStanga;
faceCalculations._1_TamplaDreapta = calculatedFaceAlignment._1_TamplaDreapta;
faceCalculations._2_Barbie = calculatedFaceAlignment._2_Barbie;
faceCalculations._3_SpranceanaDreapta = calculatedFaceAlignment._3_SpranceanaDreapta;
faceCalculations._4_ArieOchiStang = calculatedFaceAlignment._4_ArieOchiStang;
faceCalculations._5_ArieOchiDrept = calculatedFaceAlignment._5_ArieOchiDrept;
faceCalculations._6_MarimeOchiStang = calculatedFaceAlignment._6_MarimeOchiStang;
faceCalculations._7_MarimeOchiDrept = calculatedFaceAlignment._7_MarimeOchiDrept;
faceCalculations._8_InaltimeGura = calculatedFaceAlignment._8_InaltimeGura;
faceCalculations._9_Unghi_60_67 = calculatedFaceAlignment._9_Unghi_60_67;
faceCalculations._10_Unghi_64_65 = calculatedFaceAlignment._10_Unghi_64_65;
faceCalculations._11_LungimeGuraExterior = calculatedFaceAlignment._11_LungimeGuraExterior;
faceCalculations._12_UnghiNasStanga = calculatedFaceAlignment._12_UnghiNasStanga;
faceCalculations._13_UnghiNasDreapta = calculatedFaceAlignment._13_UnghiNasDreapta;
faceCalculations._14_ArieFata = calculatedFaceAlignment._14_ArieFata;
faceCalculations._15_ArieGura = calculatedFaceAlignment._15_ArieGura;
db.SubmitChanges();
}
}
示例2: Angle
public static float Angle(PointF pt1, PointF pt2)
{
if (pt1 == pt2)
return 0.0F;
else
return (float) (Math.Atan2(pt2.Y - pt1.Y, pt2.X - pt1.X) * 360.0 / (Math.PI * 2));
}
示例3: closestPointOfPolyline
public static Point closestPointOfPolyline(Point[] polyline, Point pt)
{
PointF[] Ptsf = PointsToPointsF(polyline);
PointF Ptf = PointToPointF (pt);
double distanceClosest = Double.PositiveInfinity;
PointF closestPoint = new PointF();
for(int x=0; x< Ptsf.Length-1; x++)
{
PointF closest;
double dist = FindDistanceToSegment(Ptf,
Ptsf[x],
Ptsf[x+1],
out closest);
if(dist < distanceClosest)
{
distanceClosest = dist;
closestPoint = closest;
}
}
return PointFToPoint (closestPoint);
}
示例4: Overlaps
public override bool Overlaps(RectangleShape rect, PointF offset)
{
// Two rectangles, A and B, overlap iff one of the corners of B is contained in A or if A is completely contained within B.
PointF a1 = new PointF(-rect.Width / 2 + offset.X, -rect.Height / 2 + offset.Y);
bool overlaps = (a1.X >= -width / 2) && (a1.X <= width / 2) && (a1.Y >= -height / 2) && (a1.Y <= height / 2);
if (!overlaps)
{
PointF a2 = new PointF(rect.Width / 2 + offset.X, -rect.Height / 2 + offset.Y);
overlaps = (a2.X >= -width / 2) && (a2.X <= width / 2) && (a2.Y >= -height / 2) && (a2.Y <= height / 2);
if (!overlaps)
{
PointF a3 = new PointF(rect.Width / 2 + offset.X, rect.Height / 2 + offset.Y);
overlaps = (a3.X >= -width / 2) && (a3.X <= width / 2) && (a3.Y >= -height / 2) && (a3.Y <= height / 2);
if (!overlaps)
{
PointF a4 = new PointF(-rect.Width / 2 + offset.X, rect.Height / 2 + offset.Y);
overlaps = (a4.X >= -width / 2) && (a4.X <= width / 2) && (a4.Y >= -height / 2) && (a4.Y <= height / 2);
if (!overlaps)
{
overlaps = (-width / 2 >= a1.X) && (-width / 2 <= a2.X) && (-height / 2 >= a1.Y) && (-height / 2 <= a3.Y);
}
}
}
}
return overlaps;
}
示例5: RotationParameters
public RotationParameters(float rotateX, float rotateY, float rotateZ)
{
m_rotateX = rotateX;
m_rotateY = rotateY;
m_rotateZ = rotateZ;
m_rotationCenter = new PointF(0.5f, 0.5f);
}
示例6: CustomBody
/// <summary>
/// Initializes a new instance of the <see cref="CustomBody"/> class.
/// </summary>
public CustomBody()
{
_clippedEdges = FrameEdges.None;
_handLeftConfidence = TrackingConfidence.Low;
_handLeftState = HandState.Unknown;
_handRightConfidence = TrackingConfidence.Low;
_handRightState = HandState.Unknown;
_isDisposed = false;
_isRestricted = false;
_isTracked = false;
_joints = new Dictionary<JointType, IJoint>();
_jointOrientations = new Dictionary<JointType, IJointOrientation>();
foreach (var jointType in CustomJointType.AllJoints)
{
_joints.Add(jointType, new CustomJoint(jointType));
_jointOrientations.Add(jointType, new CustomJointOrientation(jointType));
}
_lean = new PointF();
_leanTrackingState = TrackingState.NotTracked;
_trackingId = ulong.MaxValue;
_hasMappedDepthPositions = false;
_hasMappedColorPositions = false;
}
示例7: Method
static bool Method (PointF f)
{
Console.WriteLine ("Method with PointF arg: {0} {1}", f.fa, f.fb);
if (f.fa != 100 || f.fb != 200)
return false;
return true;
}
示例8: RotateAndFindNewDimensions
private static PointF RotateAndFindNewDimensions(PointF point, float angle)
{
using (Matrix matrix = new Matrix())
{
PointF[] points = new PointF[] {
new PointF(0f, 0f),
new PointF(0f, point.Y),
new PointF(point.X, 0f),
new PointF(point.X, point.Y)
};
matrix.Rotate(angle);
matrix.TransformPoints(points);
float minX = points[0].X;
float maxX = minX;
float minY = points[0].Y;
float maxY = minY;
for (int i = 1; i < 4; i++)
{
minX = Math.Min(minX, points[i].X);
maxX = Math.Max(maxX, points[i].X);
minY = Math.Min(minY, points[i].Y);
maxY = Math.Max(maxY, points[i].Y);
}
return new PointF(maxX - minX, maxY - minY);
}
}
示例9: generateTicket
public Bitmap generateTicket(string ticketType, string start, string destination, string price)
{
//Orte der verschiedenen Textboxen auf dem Ticket:
Point StartLine1 = new Point(0,100);
Point EndLine1 = new Point(960, 100);
Point StartLine2 = new Point(0, 700);
Point EndLine2 = new Point(960, 700);
PointF logoLocation = new PointF(150,20);
PointF fromLocation = new PointF(40,300);
PointF toLocation = new PointF(40,500);
PointF totalLocation = new PointF(40,750);
PointF ticketTypeLocation = new PointF(40, 150);
PointF startLocation = new PointF(40, 400);
PointF destinationLocation = new PointF(40, 600);
PointF priceLocation = new PointF(500, 750);
//string imageFilePath = "C:\\Users\\kuehnle\\Documents\\TestWebsite\\NewTestTicket.bmp";
Bitmap tempBmp = new Bitmap(960,900);
//auf das neu erstellte Bitmap draufzeichnen:
using (Graphics g = Graphics.FromImage(tempBmp))
{
g.Clear(Color.White);
g.DrawLine(new Pen(Brushes.Black,10), StartLine1, EndLine1);
g.DrawLine(new Pen(Brushes.Black,10), StartLine2, EndLine2);
using (Font arialFont = new Font("Arial", 40,FontStyle.Bold))
{
g.DrawString("Jakarta Commuter Train", arialFont, Brushes.Black, logoLocation);
g.DrawString(ticketType, arialFont, Brushes.Black, ticketTypeLocation);
}
using (Font arialFont = new Font("Arial", 40, FontStyle.Underline))
{
g.DrawString("From:", arialFont, Brushes.Black, fromLocation);
g.DrawString("To:", arialFont, Brushes.Black, toLocation);
}
using (Font arialFont = new Font("Arial", 40, FontStyle.Regular))
{
g.DrawString("Total:", arialFont, Brushes.Black, totalLocation);
g.DrawString(start, arialFont, Brushes.Black, startLocation);
g.DrawString(destination, arialFont, Brushes.Black, destinationLocation);
g.DrawString(price, arialFont, Brushes.Black, priceLocation);
}
}
//Farbtiefe auf 1 reduzieren:
Bitmap ticket = tempBmp.Clone(new Rectangle(0, 0, tempBmp.Width, tempBmp.Height),PixelFormat.Format1bppIndexed);
//ticket.Save(imageFilePath,System.Drawing.Imaging.ImageFormat.Bmp);
//ticket.Dispose();
return ticket;
}
示例10: RectangleF
// Constructors.
public RectangleF(PointF location, SizeF size)
{
x = location.X;
y = location.Y;
width = size.Width;
height = size.Height;
}
示例11: MWLocation
public MWLocation(float[] _points)
{
points = new PointF[4];
for (int i = 0; i < 4; i++)
{
points[i] = new PointF();
points[i].x = _points[i * 2];
points[i].y = _points[i * 2 + 1];
}
p1 = new PointF();
p2 = new PointF();
p3 = new PointF();
p4 = new PointF();
p1.x = _points[0];
p1.y = _points[1];
p2.x = _points[2];
p2.y = _points[3];
p3.x = _points[4];
p3.y = _points[5];
p4.x = _points[6];
p4.y = _points[7];
}
示例12: NonDefaultConstructorTest
public void NonDefaultConstructorTest(float x, float y)
{
PointF p1 = new PointF(x, y);
Assert.Equal(x, p1.X);
Assert.Equal(y, p1.Y);
}
示例13: SimulationView
public SimulationView (Context context, SensorManager sensorManager, IWindowManager window)
: base (context)
{
Bounds = new PointF ();
// Get an accelorometer sensor
sensor_manager = sensorManager;
accel_sensor = sensor_manager.GetDefaultSensor (SensorType.Accelerometer);
// Calculate screen size and dpi
var metrics = new DisplayMetrics ();
window.DefaultDisplay.GetMetrics (metrics);
meters_to_pixels_x = metrics.Xdpi / 0.0254f;
meters_to_pixels_y = metrics.Ydpi / 0.0254f;
// Rescale the ball so it's about 0.5 cm on screen
var ball = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Ball);
var dest_w = (int)(BALL_DIAMETER * meters_to_pixels_x + 0.5f);
var dest_h = (int)(BALL_DIAMETER * meters_to_pixels_y + 0.5f);
ball_bitmap = Bitmap.CreateScaledBitmap (ball, dest_w, dest_h, true);
// Load the wood background texture
var opts = new BitmapFactory.Options ();
opts.InDither = true;
opts.InPreferredConfig = Bitmap.Config.Rgb565;
wood_bitmap = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Wood, opts);
wood_bitmap2 = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Wood, opts);
display = window.DefaultDisplay;
particles = new ParticleSystem (this);
}
示例14: AddLines
public void AddLines(PointF[] points)
{
for (int index = 0; index < points.Length; ++index)
{
AddLine(points[index]);
}
}
示例15: Main
public static void Main(string[] args)
{
Graphics.DrawImageAbort imageCallback;
Bitmap outbmp = new Bitmap (300, 300);
Bitmap bmp = new Bitmap("../../Test/System.Drawing/bitmaps/almogaver24bits.bmp");
Graphics dc = Graphics.FromImage (outbmp);
ImageAttributes imageAttr = new ImageAttributes();
/* Simple image drawing */
dc.DrawImage(bmp, 0,0);
/* Drawing using points */
PointF ulCorner = new PointF(150.0F, 0.0F);
PointF urCorner = new PointF(350.0F, 0.0F);
PointF llCorner = new PointF(200.0F, 150.0F);
RectangleF srcRect = new Rectangle (0,0,100,100);
PointF[] destPara = {ulCorner, urCorner, llCorner};
imageCallback = new Graphics.DrawImageAbort(DrawImageCallback);
dc.DrawImage (bmp, destPara, srcRect, GraphicsUnit.Pixel, imageAttr, imageCallback);
/* Using rectangles */
RectangleF destRect = new Rectangle (10,200,100,100);
RectangleF srcRect2 = new Rectangle (50,50,100,100);
dc.DrawImage (bmp, destRect, srcRect2, GraphicsUnit.Pixel);
/* Simple image drawing with with scaling*/
dc.DrawImage(bmp, 200,200, 75, 75);
outbmp.Save("drawimage.bmp", ImageFormat.Bmp);
}