本文整理汇总了C#中biz.ritter.javapi.currentSegment方法的典型用法代码示例。如果您正苦于以下问题:C# biz.ritter.javapi.currentSegment方法的具体用法?C# biz.ritter.javapi.currentSegment怎么用?C# biz.ritter.javapi.currentSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biz.ritter.javapi
的用法示例。
在下文中一共展示了biz.ritter.javapi.currentSegment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: intersectPath
/**
* Returns how many times rectangle stripe cross path or the are intersect
*/
public static int intersectPath(java.awt.geom.PathIterator p, double x, double y, double w, double h)
{
int cross = 0;
int count;
double mx, my, cx, cy;
mx = my = cx = cy = 0.0;
double[] coords = new double[6];
double rx1 = x;
double ry1 = y;
double rx2 = x + w;
double ry2 = y + h;
while (!p.isDone())
{
count = 0;
switch (p.currentSegment(coords))
{
case java.awt.geom.PathIteratorConstants.SEG_MOVETO:
if (cx != mx || cy != my)
{
count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
}
mx = cx = coords[0];
my = cy = coords[1];
break;
case java.awt.geom.PathIteratorConstants.SEG_LINETO:
count = intersectLine(cx, cy, cx = coords[0], cy = coords[1], rx1, ry1, rx2, ry2);
break;
case java.awt.geom.PathIteratorConstants.SEG_QUADTO:
count = intersectQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], rx1, ry1, rx2, ry2);
break;
case java.awt.geom.PathIteratorConstants.SEG_CUBICTO:
count = intersectCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], rx1, ry1, rx2, ry2);
break;
case java.awt.geom.PathIteratorConstants.SEG_CLOSE:
if (cy != my || cx != mx)
{
count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
}
cx = mx;
cy = my;
break;
}
if (count == CROSSING)
{
return CROSSING;
}
cross += count;
p.next();
}
if (cy != my)
{
count = intersectLine(cx, cy, mx, my, rx1, ry1, rx2, ry2);
if (count == CROSSING)
{
return CROSSING;
}
cross += count;
}
return cross;
}
示例2: crossPath
/**
* Returns how many times ray from point (x,y) cross path
*/
public static int crossPath(java.awt.geom.PathIterator p, double x, double y)
{
int cross = 0;
double mx, my, cx, cy;
mx = my = cx = cy = 0.0;
double[] coords = new double[6];
while (!p.isDone())
{
switch (p.currentSegment(coords))
{
case java.awt.geom.PathIteratorConstants.SEG_MOVETO:
if (cx != mx || cy != my)
{
cross += crossLine(cx, cy, mx, my, x, y);
}
mx = cx = coords[0];
my = cy = coords[1];
break;
case java.awt.geom.PathIteratorConstants.SEG_LINETO:
cross += crossLine(cx, cy, cx = coords[0], cy = coords[1], x, y);
break;
case java.awt.geom.PathIteratorConstants.SEG_QUADTO:
cross += crossQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], x, y);
break;
case java.awt.geom.PathIteratorConstants.SEG_CUBICTO:
cross += crossCubic(cx, cy, coords[0], coords[1], coords[2], coords[3], cx = coords[4], cy = coords[5], x, y);
break;
case java.awt.geom.PathIteratorConstants.SEG_CLOSE:
if (cy != my || cx != mx)
{
cross += crossLine(cx, cy, cx = mx, cy = my, x, y);
}
break;
}
// checks if the point (x,y) is the vertex of shape with PathIterator p
if (x == cx && y == cy)
{
cross = 0;
cy = my;
break;
}
p.next();
}
if (cy != my)
{
cross += crossLine(cx, cy, mx, my, x, y);
}
return cross;
}