/* 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.Ellipse2D; import java.awt.geom.Point2D; import vmm.core.Transform; public class Dot2D extends GeometryElement2D { double diameter; double x, y; public Dot2D(double x, double y, double diameter) { this.x = x; this.y = y; this.diameter = diameter; } protected void draw(Transform transform, Graphics2D g) { Point2D.Double center = new Point2D.Double(x,y); transform.windowToDrawingCoords(center); double h = diameter*transform.getPixelWidth(); double w = diameter*transform.getPixelHeight(); g.fill(new Ellipse2D.Double(center.x-h/2,center.y-w/2,h,w)); } }