识别自由细分市场,夸张或多边形的最佳方法,没有java.aw.awt
我正在从事一个项目,基本上我有这个东西每次都绘制段,此类段,我有2个对象PointonThearea向我展示了飞机中该片段的两个末端:
public class PointOnTheArea implements Point {
private final double pointX;
private final double pointY;
public PointOnTheArea(double x, double y){
this.pointY = y;
this.pointX = x;
}
public double getX(){
return pointX;
}
public double getY(){
return pointY;
}
}
public class Segment {
private PointOnTheArea startingPoint;
private PointOnTheArea endingPoint;
private final SegmentType segmentType; // It is just for straight or curve
private final int radius; // just for curve segments
private final Direction dir; // direction it was drawn, is only for the plane
private boolean isTaken = false; // it is already part of a polygon???
private final int size; // distance between points
private final Color myColor; // just the color of the line
public Segment(int x1, int y1, int x2, int y2, SegmentType type, Direction dir, int radius, Color myColor){
this.segmentType = type;
this.radius = radius;
this.dir = dir;
setSegment(x1, y1, x2, y2);
this.myColor = myColor;
this.size = (int) Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));
}
并且我希望找到一种存储此片段和的方法用多边形,夸张或自由段区分它们:
- 双曲线是一系列段的序列,具有一个共同点(段的起点=另一个端点的起点=另外1)
- polyop是一个在段之间创建的循环,每个人在每个人之间都与每个人共享他的终点下一个的起点,您不能有2个结尾或2个共同点(请注意,可以从段列表的第四个元素开始到最后一个,因此可以创建多边形双曲线)
- 但没有附加任何其他细分市场
免费细分细分市场,即创建但在我想到的linkedlist的项目时,已经创建 一些想法?我将非常感谢3; 3
,不,我不能使用java.aw.awt
im working on a project and basically i have this thing that draw segments every time, this class segment i have 2 objects PointOnTheArea which show me the two ends of the segment in the plane:
public class PointOnTheArea implements Point {
private final double pointX;
private final double pointY;
public PointOnTheArea(double x, double y){
this.pointY = y;
this.pointX = x;
}
public double getX(){
return pointX;
}
public double getY(){
return pointY;
}
}
public class Segment {
private PointOnTheArea startingPoint;
private PointOnTheArea endingPoint;
private final SegmentType segmentType; // It is just for straight or curve
private final int radius; // just for curve segments
private final Direction dir; // direction it was drawn, is only for the plane
private boolean isTaken = false; // it is already part of a polygon???
private final int size; // distance between points
private final Color myColor; // just the color of the line
public Segment(int x1, int y1, int x2, int y2, SegmentType type, Direction dir, int radius, Color myColor){
this.segmentType = type;
this.radius = radius;
this.dir = dir;
setSegment(x1, y1, x2, y2);
this.myColor = myColor;
this.size = (int) Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));
}
and im looking to find a way to store this segments and differentiate them in polygons, hyperbole or free segments:
- Hyperbola is a sequence of segments that have a junction point in common (starting point of a segment = endingPoint of another 1)
- Polygon is a loop that is created between segments everyone shares his endingPoint with the startingPoint of the next one, you cannot have 2 endingPoing or 2 starting Points in common (note that a polygon could be created starting from the fourth element of a List of segments up to the last one, therefore the first ones three would become a separate hyperbola)
- Free segments, i.e. segments that have been created but are not attached to any other segment
when I started the project I had thought of a LinkedList but now I find it difficult to manage everything, as many borderline cases remain uncovered, do u have some ideas? i ll appreciate a lot <3
AND NO i cannot use java.awt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论