Calculates the points for a rounded rectangle.

@param  Point    $corner  The top left corner.
@param  float    $width
@param  float    $height
@param  float    $radius
@param  boolean  $ccw     Whether to list the points counterclockwise or not.
423450
public static function roundedRectangle(Point $corner, $width, $height, $radius, $ccw = false)
	{
		$points = new Points($corner, false);
		$points->addPoint($corner)->translateX($width - $radius);
		$points->addPoint($corner)->translate($width, $radius);
		$points->addPoint($corner)->translate($width, $height - $radius);
		$points->addPoint($corner)->translate($width - $radius, $height);
		$points->addPoint($corner)->translate($radius, $height);
		$points->addPoint($corner)->translateY($height - $radius);
		$points->addPoint($corner)->translateY($radius);
		$points->addPoint($corner)->translateX($radius);
		$points->reverseIfCcw($ccw);
		return $points;
	}
472648
public void setProperties(Point3d center, DoubleProperty radius1) {
		setProperties(center.xProperty,center.yProperty,center.zProperty, radius1);
	}
1281864
public TriangulationPoint pointCCW( TriangulationPoint point )
    {
        if( point == points[0] )
        {
            return points[1];
        }
        else if( point == points[1] )
        {
            return points[2];
        }
        else if( point == points[2] )
        {
            return points[0];
        }
        logger.error( "point location error" );
        throw new RuntimeException("[FIXME] point location error");
    }
837525
def _draw_rectangle(context, width, height):
        
        c = context
        # First move to upper left corner
        c.rel_move_to(-width / 2., -height / 2.)
        # Draw closed rectangle
        c.rel_line_to(width, 0)
        c.rel_line_to(0, height)
        c.rel_line_to(-width, 0)
        c.close_path()
453584
def point(self, x, y, z=0, m=0):
        """"""
        pointShape = _Shape(self.shapeType)
        pointShape.points.append([x, y, z, m])
        self._shapes.append(pointShape)
447430
function(corner, size, scale) {
		scale = scale || 1;
		size = size || this.size;

		var width = size[0] * scale,
			height = size[1] * scale,
			width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),

		// Define tip coordinates in terms of height and width values
		tips = {
			br:	[0,0,		width,height,	width,0],
			bl:	[0,0,		width,0,		0,height],
			tr:	[0,height,	width,0,		width,height],
			tl:	[0,0,		0,height,		width,height],
			tc:	[0,height,	width2,0,		width,height],
			bc:	[0,0,		width,0,		width2,height],
			rc:	[0,0,		width,height2,	0,height],
			lc:	[width,0,	width,height,	0,height2]
		};

		// Set common side shapes
		tips.lt = tips.br; tips.rt = tips.bl;
		tips.lb = tips.tr; tips.rb = tips.tl;

		return tips[ corner.abbrev() ];
	}
217043
function filledRectangle($x1, $y1, $width, $height)
    {
        $this->addContent(sprintf("\n%.3F %.3F %.3F %.3F re f", $x1, $y1, $width, $height));
    }
843944
public void setShape(double width , double height ) {
		points2D3D.get(0).location.set(-width/2,-height/2,0);
		points2D3D.get(1).location.set(-width/2, height/2,0);
		points2D3D.get(2).location.set( width/2, height/2,0);
		points2D3D.get(3).location.set( width/2,-height/2,0);
	}
401885
@Override
	@Pure
	public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
		if (boundsIntersects(rectangle)) {

			if (rectangle.intersects(getBoundingBox())) {
				return true;
			}

			if (this.isWidePolyline) {
				final Rectangle2afp<?, ?, ?, ?, ?, ?> box = rectangle.toBoundingBox();
				final double rminX = box.getMinX();
				final double rminY = box.getMinY();
				final double rmaxX = box.getMaxX();
				final double rmaxY = box.getMaxY();

				final double width = getWidth();

				boolean firstPoint;
				double px = 0;
				double py = 0;

				for (final PointGroup grp : groups()) {
					firstPoint = true;
					for (final Point2d pts : grp) {
						final double x = pts.getX();
						final double y = pts.getY();

						if (firstPoint) {
							firstPoint = false;
						} else if (MathUtil.min(
								Segment2afp.calculatesDistanceSquaredSegmentSegment(rminX, rmaxY, rmaxX, rmaxY, px, py, x, y),
								Segment2afp.calculatesDistanceSquaredSegmentSegment(rminX, rminY, rminX, rmaxY, px, py, x, y),
								Segment2afp.calculatesDistanceSquaredSegmentSegment(rmaxX, rminY, rmaxX, rmaxY, px, py, x, y))
								<= width * width) {
							return true;
						}

						px = x;
						py = y;
					}
				}
			} else {
				return toPath2D().intersects(rectangle);
			}
		}
		return false;
	}
66653
def is_ccw(points):
    
    points = np.asanyarray(points, dtype=np.float64)

    if (len(points.shape) != 2 or
            points.shape[1] != 2):
        raise ValueError('CCW is only defined for 2D')
    xd = np.diff(points[:, 0])
    yd = np.column_stack((
        points[:, 1],
        points[:, 1])).reshape(-1)[1:-1].reshape((-1, 2)).sum(axis=1)
    area = np.sum(xd * yd) * .5
    ccw = area < 0

    return ccw
1248725
function(geometry, style, featureId) {
        if(style.graphic !== false) {
            if(style.externalGraphic) {
                this.drawExternalGraphic(geometry, style, featureId);
            } else if (style.graphicName && (style.graphicName != "circle")) {
                this.drawNamedSymbol(geometry, style, featureId);
            } else {
                var pt = this.getLocalXY(geometry);
                var p0 = pt[0];
                var p1 = pt[1];
                if(!isNaN(p0) && !isNaN(p1)) {
                    var twoPi = Math.PI*2;
                    var radius = style.pointRadius;
                    if(style.fill !== false) {
                        this.setCanvasStyle("fill", style);
                        this.canvas.beginPath();
                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
                        this.canvas.fill();
                        if (this.hitDetection) {
                            this.setHitContextStyle("fill", featureId, style);
                            this.hitContext.beginPath();
                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
                            this.hitContext.fill();
                        }
                    }

                    if(style.stroke !== false) {
                        this.setCanvasStyle("stroke", style);
                        this.canvas.beginPath();
                        this.canvas.arc(p0, p1, radius, 0, twoPi, true);
                        this.canvas.stroke();
                        if (this.hitDetection) {
                            this.setHitContextStyle("stroke", featureId, style);
                            this.hitContext.beginPath();
                            this.hitContext.arc(p0, p1, radius, 0, twoPi, true);
                            this.hitContext.stroke();
                        }
                        this.setCanvasStyle("reset");
                    }
                }
            }
        }
    }
1008366
public function inside(QtiPoint $point)
    {
        if ($this->getShape() === QtiShape::DEF) {
            return true;
        } elseif ($this->getShape() === QtiShape::RECT) {
            return $point->getX() >= $this[0] && $point->getX() <= $this[2] && $point->getY() >= $this[1] && $point->getY() <= $this[3];
        } elseif ($this->getShape() === QtiShape::CIRCLE) {
            return pow($point->getX() - $this[0], 2) + pow($point->getY() - $this[1], 2) < pow($this[2], 2);
        } else {
            // we consider it is a polygon.
            // - Transform coordinates in vertices.
            // -- Use of the "point in polygon" algorithm.
            $vertices = array();
            for ($i = 0; $i < count($this); $i++) {
                $vertex = array();
                $vertex[] = $this[$i]; //x
                $i++;
                $vertex[] = $this[$i]; //y

                $vertices[] = $vertex;
            }

            $intersects = 0;
            for ($i = 1; $i < count($vertices); $i++) {
                $vertex1 = $vertices[$i -1];
                $vertex2 = $vertices[$i];

                if ($vertex1[1] === $vertex2[1] && $vertex1[1] === $point->getY() && $point->getX() > min($vertex1[0], $vertex2[0]) && $point->getX() < max($vertex1[0], $vertex2[0])) {
                    // we are on a boundary.
                    return true;
                }

                if ($point->getY() > min($vertex1[1], $vertex2[1]) && $point->getY() <= max($vertex1[1], $vertex2[1]) && $point->getX() <= max($vertex1[0], $vertex2[0]) && $vertex1[1] !== $vertex2[1]) {
                    $xinters = ($point->getY() - $vertex1[1]) * ($vertex2[0] - $vertex1[0]) / ($vertex2[1] - $vertex1[1]) + $vertex1[0];

                    if ($xinters === $point->getX()) {
                        // Again, we are on a boundary.
                        return true;
                    }

                    if ($vertex1[0] === $vertex2[0] || $point->getX() <= $xinters) {
                        // We have a single intersection.
                        $intersects++;
                    }
                }
            }

            // If we passed through an odd number of edges, we are in the polygon!
            return $intersects % 2 !== 0;
        }
    }
153693
function roundedCorners(side, radius) {
  if (!radius) {
    radius = side || 10;
    side   = 'all';
  }
  if (side == 'all') {
    if (browserInfo().msie) {
      return {
        'border-radius': radius,
        behavior:        'url(border-radius-ie.htc)',
        visibility:      'hidden'
      }
    } else if (browserInfo().mozilla) {
      return {
        '-moz-border-radius': radius
      }

    } else {
      return {
        'border-radius':         radius,
        '-webkit-border-radius': radius
      }
    }
  } else {
    var rules = {};
    if (side == 'tl' || side == 'top' || side == 'left') {
      rules['-moz-border-radius-topleft']     = radius;
      rules['-webkit-border-top-left-radius'] = radius;
      rules['border-top-left-radius']         = radius;
    }
    if (side == 'tr' || side == 'top' || side == 'right') {
      rules['-webkit-border-top-right-radius'] = radius;
      rules['-moz-border-radius-topright']     = radius;
      rules['border-top-right-radius']         = radius;
    }
    if (side == 'bl' || side == 'bottom' || side == 'left') {
      rules['-webkit-border-bottom-left-radius'] = radius;
      rules['-moz-border-radius-bottomleft']     = radius;
      rules['border-bottom-left-radius']         = radius;
    }
    if (side == 'br' || side == 'bottom' || side == 'right') {
      rules['-webkit-border-bottom-right-radius'] = radius;
      rules['-moz-border-radius-bottomright']     = radius;
      rules['border-bottom-right-radius']         = radius;
    }
    return rules;
  }
}
40472
public TriangulationPoint pointCW( TriangulationPoint point )
    {
        if( point == points[0] )
        {
            return points[2];
        }
        else if( point == points[1] )
        {
            return points[0];
        }
        else if( point == points[2] )
        {
            return points[1];
        }
        logger.error( "point location error" );
        throw new RuntimeException("[FIXME] point location error");
    }
951362
def draw_rectangle(x, y, width, height)
      @context.drawRect(x, y, width, height)
    end
80802
protected function calcPercent($width, $height)
    {
        $newWidth = ($width * $this->percent) / 100;
        $newHeight = ($height * $this->percent) / 100;

        return array(
            'newWidth' => ceil($newWidth),
            'newHeight' => ceil($newHeight)
        );
    }
897504
protected Rectangle applyClip(Shape current, Rectangle newclip)
    {
        if (current == null)
            return newclip;
        else
        {
            if (current instanceof Rectangle)
                return ((Rectangle) current).intersection(newclip);
            else
                return current.getBounds().intersection(newclip);
        }
    }