/*  This file is part of the source code for 3D-XplorMath-J, Version 1.0 (January 2008).
 *  Copyright (c) 2008 The 3D-XplorMath Consortium (http://3d-xplormath.org).
 *  This source code is released under a BSD License, which allows redistribution   
 *  in source and binary form, with or without modification, provided copyright
 *  and license information are included, and with no warranty or guarantee of
 *  any kind.  For details, see http://3d-xplormath.org/j/source/BSDLicense.txt
 */
 
 package vmm.core.render;

import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;

import vmm.core.Transform;

public class LineSegment2D extends GeometryElement2D {
	
	private double x1, x2, y1, y2;
	
	public LineSegment2D(double x1, double y1, double x2, double y2) {
		this.x1 = x1;
		this.x2 = x2;
		this.y1 = y1;
		this.y2 = y2;
	}

	protected void draw(Transform transform, Graphics2D g) {
		Point2D.Double p1 = new Point2D.Double(x1,y1);
		Point2D.Double p2 = new Point2D.Double(x2,y2);
		transform.windowToDrawingCoords(p1);
		transform.windowToDrawingCoords(p2);
		g.draw(new Line2D.Double(p1,p2));
	}

}
