2024-06-12
This commit is contained in:
75
Writerside2/topics/Geometrics.md
Normal file
75
Writerside2/topics/Geometrics.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# 도형
|
||||
|
||||
## Point
|
||||
|
||||
* Point2D.Double
|
||||
* Point2D.Float
|
||||
|
||||
```java
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
Point2D point = new Point2D.Double(x, y);
|
||||
```
|
||||
|
||||
## Line
|
||||
|
||||
* Line2D.Double
|
||||
* Line2D.Float
|
||||
|
||||
```java
|
||||
import java.awt.geom.Line2D;
|
||||
|
||||
Line2D line = new Line2D.Double(point1, point2);
|
||||
```
|
||||
|
||||
## Curve
|
||||
|
||||
```java
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.QuadCurve2D;
|
||||
|
||||
QuadCurve2D quadCurve = new QuadCurve2D.Double(x1, y1, ctrlx, ctrly, x2, y2);
|
||||
|
||||
CubicCurve2D cubicCurve = new CubicCurve2D.Double(x1, y1, ctrlx1, ctrly1, ctrlx2,ctrly2,x2, y2);
|
||||
```
|
||||
|
||||
## Rectangle
|
||||
|
||||
```java
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
Rectangle2D rectangle = new Rectangle2D.Double(x, y, width, height);
|
||||
|
||||
RoundRectangle2D roundRectangle = new RoundRectangle2D.Double(x,y,width,height,archw,archy);
|
||||
```
|
||||
|
||||
## Ellipse
|
||||
|
||||
```java
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
Ellipse2D ellipse = new Ellipse2D.Double(x,y,width,height);
|
||||
```
|
||||
|
||||
## Arc
|
||||
|
||||
```java
|
||||
import java.awt.geom.Arc2D;
|
||||
|
||||
Arc2D arc = new Arc2D.Double(x,y,width,height,start,extent,type);
|
||||
```
|
||||
|
||||
## GeneralPath
|
||||
|
||||
* `moveTo(x,y)`
|
||||
* `lineTo(x,y)`
|
||||
* `quadTo(ctrlx,ctrly,x2,y2)`
|
||||
* `curveTo(ctrlx1,ctrly1,ctrlx2,ctrly2,x2,y2)`
|
||||
* `closePath()`
|
||||
|
||||
```java
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
GeneralPath path = new GeneralPath();
|
||||
```
|
||||
Reference in New Issue
Block a user