本文整理匯總了C#中System.Point.getX方法的典型用法代碼示例。如果您正苦於以下問題:C# Point.getX方法的具體用法?C# Point.getX怎麽用?C# Point.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Point
的用法示例。
在下文中一共展示了Point.getX方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: WritePoint
private void WritePoint(Point point, WKBByteOrder byteOrder, bool writeHeader)
{
if (writeHeader)
{
// Write byte order
_writer.Write((byte)byteOrder);
// Write type
this.WriteType(point, byteOrder);
}
// Write the x coordinate.
this.Write(point.getX(), byteOrder);
// Write the y coordinate.
this.Write(point.getY(), byteOrder);
}
示例2: Line
private void Line(Point point1, Point point2)
{
int x1 = point1.getX();
int y1 = point1.getY();
int x2 = point2.getX();
int y2 = point2.getY();
double m = (y1 - (double)y2) / (x1 - x2);
double c = y1 - (x1 * m);
double yIntersect = c;
double xIntersect = c / -m;
bool validYIntersect = false;
bool validXIntersect = false;
if (y1 < y2) {
if (y1 <= yIntersect && yIntersect <= y2) {
validYIntersect = true;
}
} else {
if (y2 <= yIntersect && yIntersect <= y1) {
validYIntersect = true;
}
}
if (x1 < x2) {
if (x1 <= xIntersect && xIntersect <= x2) {
validXIntersect = true;
}
} else {
if (x2 <= xIntersect && xIntersect <= x1) {
validXIntersect = true;
}
}
if(validYIntersect) {
if (yIntersect < 0) {
yLessZero++;
} else if (0 < yIntersect) {
yGreaterZero++;
}
}
if (validXIntersect) {
if (xIntersect < 0) {
xLessZero++;
} else if (0 < xIntersect) {
xGreaterZero++;
}
}
}