src/main/java/de/hfu/in/machinelearning/crawling_robot_2d_sim/models/ShapeRenderer.java
public static final void render(Graphics2D g, Capsule capsule, double scale, Color color) {
		// get the local rotation and translation
		double rotation = capsule.getRotation();
		Vector2 center = capsule.getCenter();
		
		// save the old transform
		AffineTransform oTransform = g.getTransform();
		// translate and rotate
		g.translate(center.x * scale, center.y * scale);
		g.rotate(rotation);
		
		double width = capsule.getLength();
		double radius = capsule.getCapRadius();
		double radius2 = radius * 2.0;
		
		Arc2D.Double arcL = new Arc2D.Double(
				-(width * 0.5) * scale,
				-radius * scale,
				radius2 * scale,
				radius2 * scale,
				90.0,
				180.0,
				Arc2D.OPEN);
		Arc2D.Double arcR = new Arc2D.Double(
				(width * 0.5 - radius2) * scale,
				-radius * scale,
				radius2 * scale,
				radius2 * scale,
				-90.0,
				180.0,
				Arc2D.OPEN);
		
		// connect the shapes
		Path2D.Double path = new Path2D.Double();
		path.append(arcL, true);
		path.append(new Line2D.Double(arcL.getEndPoint(), arcR.getStartPoint()), true);
		path.append(arcR, true);
		path.append(new Line2D.Double(arcR.getEndPoint(), arcL.getStartPoint()), true);
		
		// set the color
		g.setColor(color);
		// fill the shape
		g.fill(path);
		// set the color
		g.setColor(getOutlineColor(color));
		// draw the shape
		g.draw(path);
		
		// re-instate the old transform
		g.setTransform(oTransform);
	}
/**
	 * Renders the given {@link Capsule} to the given graphics context using the given scale and color.
	 * @param g the graphics context
	 * @param capsule the capsule to render
	 * @param scale the scale to render the shape (pixels per dyn4j unit (typically meter))
	 * @param color the color
	 */
Renders the given  Capsule to the given graphics context using the given scale and color.
@param g the graphics context
@param capsule the capsule to render
@param scale the scale to render the shape (pixels per dyn4j unit (typically meter))
@param color the color
Renders the given Capsule to the given graphics context using the given scale and color . @param g the graphics context @param capsule the capsule to render @param scale the scale to render the shape ( pixels per dyn4j unit ( typically meter )) @param color the color
public static final void render(Graphics2D g, Capsule capsule, double scale, Color color) {
		double rotation = capsule.getRotation();
		Vector2 center = capsule.getCenter();
		AffineTransform oTransform = g.getTransform();
		g.translate(center.x * scale, center.y * scale);
		g.rotate(rotation);
		double width = capsule.getLength();
		double radius = capsule.getCapRadius();
		double radius2 = radius * 2.0;
		Arc2D.Double arcL = new Arc2D.Double(
				-(width * 0.5) * scale,
				-radius * scale,
				radius2 * scale,
				radius2 * scale,
				90.0,
				180.0,
				Arc2D.OPEN);
		Arc2D.Double arcR = new Arc2D.Double(
				(width * 0.5 - radius2) * scale,
				-radius * scale,
				radius2 * scale,
				radius2 * scale,
				-90.0,
				180.0,
				Arc2D.OPEN);
		Path2D.Double path = new Path2D.Double();
		path.append(arcL, true);
		path.append(new Line2D.Double(arcL.getEndPoint(), arcR.getStartPoint()), true);
		path.append(arcR, true);
		path.append(new Line2D.Double(arcR.getEndPoint(), arcL.getStartPoint()), true);
		g.setColor(color);
		g.fill(path);
		g.setColor(getOutlineColor(color));
		g.draw(path);
		g.setTransform(oTransform);
	}
public static final void render ( Graphics2D g , Capsule capsule , double scale , Color color ) { double rotation = capsule . getRotation ( ) ; Vector2 center = capsule . getCenter ( ) ; AffineTransform oTransform = g . getTransform ( ) ; g . translate ( center . x * scale , center . y * scale ) ; g . rotate ( rotation ) ; double width = capsule . getLength ( ) ; double radius = capsule . getCapRadius ( ) ; double radius2 = radius * 2.0 ; Arc2D . Double arcL = new Arc2D . Double ( - ( width * 0.5 ) * scale , - radius * scale , radius2 * scale , radius2 * scale , 90.0 , 180.0 , Arc2D . OPEN ) ; Arc2D . Double arcR = new Arc2D . Double ( ( width * 0.5 - radius2 ) * scale , - radius * scale , radius2 * scale , radius2 * scale , - 90.0 , 180.0 , Arc2D . OPEN ) ; Path2D . Double path = new Path2D . Double ( ) ; path . append ( arcL , true ) ; path . append ( new Line2D . Double ( arcL . getEndPoint ( ) , arcR . getStartPoint ( ) ) , true ) ; path . append ( arcR , true ) ; path . append ( new Line2D . Double ( arcR . getEndPoint ( ) , arcL . getStartPoint ( ) ) , true ) ; g . setColor ( color ) ; g . fill ( path ) ; g . setColor ( getOutlineColor ( color ) ) ; g . draw ( path ) ; g . setTransform ( oTransform ) ; }
Renders the given {@link Capsule} to the given graphics context using the given scale and color.
Renders the given { @link Capsule } to the given graphics context using the given scale and color .
// get the local rotation and translation // save the old transform // translate and rotate // connect the shapes // set the color // fill the shape // set the color // draw the shape // re-instate the old transform