• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Circle2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中math.geom2d.conic.Circle2D的典型用法代码示例。如果您正苦于以下问题:Java Circle2D类的具体用法?Java Circle2D怎么用?Java Circle2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Circle2D类属于math.geom2d.conic包,在下文中一共展示了Circle2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: transform

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
@Override
public CircleLine2D transform(CircleInversion2D inv) {
	// Extract inversion parameters
       Point2D center 	= inv.getCenter();
       double r 		= inv.getRadius();
       
       Point2D po 	= this.getProjectedPoint(center);
       double d 	= this.getDistance(po);

       // Degenerate case of a point belonging to the line:
       // the transform is the line itself.
       if (Math.abs(d)<Shape2D.ACCURACY){
       	return new StraightLine2D(this);
       }
       
       // angle from center to line
       double angle = Angle2D.getHorizontalAngle(center, po);

       // center of transformed circle
       double r2 	= r*r/d/2;
       Point2D c2 	= Point2D.createPolar(center, r2, angle);

       // choose direction of circle arc
       boolean direct = !this.isInside(center);
       
       // return the created circle
       return new Circle2D(c2, r2, direct);
   }
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:29,代码来源:StraightLine2D.java


示例2: findIntersections

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
/**
 * Compute the intersections, if they exist, of two circulinear elements.
 */
public static Collection<Point2D> findIntersections(
		CirculinearElement2D elem1, 
		CirculinearElement2D elem2) {
	
	// First try to use linear shape methods
	if(elem1 instanceof LinearShape2D) {
		return elem2.getIntersections((LinearShape2D) elem1);
	}		
	if(elem2 instanceof LinearShape2D) {
		return elem1.getIntersections((LinearShape2D) elem2);
	}
	
	// From now, both elem1 and elem2 are instances of CircleShape2D
	// It is therefore possible to extract support circles
	Circle2D circ1 = ((CircularShape2D) elem1).getSupportingCircle();
	Circle2D circ2 = ((CircularShape2D) elem2).getSupportingCircle();
	
	// create array for storing result (max 2 possible intersections)
	ArrayList<Point2D> pts = new ArrayList<Point2D>(2);
	
	// for each of the circle intersections, check if they belong to
	// both elements
	for(Point2D inter : Circle2D.getIntersections(circ1, circ2)) {
		if(elem1.contains(inter) && elem2.contains(inter))
			pts.add(inter);
	}
	
	// return found intersections
	return pts;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:34,代码来源:CirculinearCurve2DUtils.java


示例3: computeBuffer

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
/**
 * Compute buffer of a point set.
 */
public static CirculinearDomain2D computeBuffer(PointSet2D set, 
		double dist) {
	// create array for storing result
	Collection<CirculinearContour2D> contours = 
		new ArrayList<CirculinearContour2D>(set.getPointNumber());
	
	// for each point, add a new circle
	for(Point2D point : set) {
		contours.add(new Circle2D(point, Math.abs(dist), dist>0));
	}
	
	// process circles to remove intersections
	contours = splitIntersectingContours(contours);
	
	// Remove contours that cross or that are too close from base curve
	ArrayList<CirculinearContour2D> contours2 = 
		new ArrayList<CirculinearContour2D>(contours.size());
	for(CirculinearContour2D ring : contours) {
		
		// check that vertices of contour are not too close from original
		// curve
		double minDist = getDistanceCurvePoints(ring, set.getPoints());
		if(minDist<dist-Shape2D.ACCURACY)
			continue;
		
		// keep the contours that meet the above conditions
		contours2.add(ring);
	}

	return new GenericCirculinearDomain2D(new CirculinearBoundarySet2D(contours2));
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:35,代码来源:CirculinearCurve2DUtils.java


示例4: drawCircle

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
protected void drawCircle(Graphics2D g, ScreenTransform t, Pair<Integer, Integer> location, int range) {
    int x = location.first();
    int y = location.second();
    int d = t.xToScreen(x + range) - t.xToScreen(x);
    Circle2D circle2D = new Circle2D(t.xToScreen(x), t.yToScreen(y), d, true);
    circle2D.draw(g);
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:8,代码来源:MrlBaseHumanLayer.java


示例5: render

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
@Override
public Collection<RenderedObject> render(Graphics2D g, ScreenTransform t, int width, int height) {
    if (xy != null) {
        int radius = 20;
        int x = t.xToScreen(xy.first());
        int y = t.yToScreen(xy.second());
        g.setColor(valueColor);
        g.drawOval(x - radius, y - radius, radius << 1, radius << 1);

        Circle2D circle2D = new Circle2D(t.xToScreen(xy.first()), t.yToScreen(xy.second()), 3d, true);
        circle2D.draw(g);
    }
    return new ArrayList<RenderedObject>();
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:15,代码来源:MrlLocationLayer.java


示例6: paintData

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
@Override
    protected void paintData(Human h, Shape shape, Graphics2D g, ScreenTransform t) {
        g.setColor(Color.MAGENTA.darker());
        Circle2D circle2D = new Circle2D(t.xToScreen(h.getX()), t.yToScreen(h.getY()), 18d, true);
        circle2D.draw(g);
//        g.fill(shape);
    }
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:8,代码来源:MrlSampleHumansLayer.java


示例7: transform

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
@Override
public CircleLine2D transform(CircleInversion2D inv) {
    // Extract inversion parameters
    Point2D center = inv.center();
    double r = inv.radius();

    // projection of inversion center on the line
    Point2D po = this.projectedPoint(center);
    double d = this.distance(center);

    // Degenerate case of a point belonging to the line:
    // the transform is the line itself.
    if (Math.abs(d) < Shape2D.ACCURACY) {
        return new StraightLine2D(this);
    }

    // angle from center to line
    double angle = Angle2D.horizontalAngle(center, po);

    // center of transformed circle
    double r2 = r * r / d / 2;
    Point2D c2 = Point2D.createPolar(center, r2, angle);

    // choose direction of circle arc
    boolean direct = this.isInside(center);

    // return the created circle
    return new Circle2D(c2, r2, direct);
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:30,代码来源:StraightLine2D.java


示例8: createParallelContour

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public CirculinearContour2D createParallelContour(
        CirculinearContour2D contour, double dist) {

    // straight line is already a circulinear contour
    if (contour instanceof StraightLine2D) {
        return ((StraightLine2D) contour).parallel(dist);
    }
    // The circle is already a circulinear contour
    if (contour instanceof Circle2D) {
        return ((Circle2D) contour).parallel(dist);
    }

    // extract collection of parallel curves, that connect each other
    Collection<CirculinearContinuousCurve2D> parallelCurves = getParallelElements(
            contour, dist);

    // Create a new boundary with the set of parallel curves
    return new BoundaryPolyCirculinearCurve2D(parallelCurves,
            contour.isClosed());
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:21,代码来源:BufferCalculator.java


示例9: computeBuffer

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
/**
 * Compute buffer of a point set.
 */
public CirculinearDomain2D computeBuffer(PointSet2D set, double dist) {
    // create array for storing result
    Collection<CirculinearContour2D> contours = new ArrayList<CirculinearContour2D>(
            set.size());

    // for each point, add a new circle
    for (Point2D point : set) {
        contours.add(new Circle2D(point, Math.abs(dist), dist > 0));
    }

    // process circles to remove intersections
    contours = CirculinearCurves2D.splitIntersectingContours(contours);

    // Remove contours that cross or that are too close from base curve
    ArrayList<CirculinearContour2D> contours2 = new ArrayList<CirculinearContour2D>(
            contours.size());
    for (CirculinearContour2D ring : contours) {

        // check that vertices of contour are not too close from original
        // curve
        double minDist = CirculinearCurves2D.getDistanceCurvePoints(ring,
                set.points());
        if (minDist < dist - Shape2D.ACCURACY)
            continue;

        // keep the contours that meet the above conditions
        contours2.add(ring);
    }

    return new GenericCirculinearDomain2D(new CirculinearContourArray2D(
            contours2));
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:36,代码来源:BufferCalculator.java


示例10: CircleInversion2D

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public CircleInversion2D(Circle2D circle) {
    this.circle = circle;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:4,代码来源:CircleInversion2D.java


示例11: setCircle

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public void setCircle(double xc, double yc, double r) {
    this.circle = new Circle2D(xc, yc, r);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:4,代码来源:CircleInversion2D.java


示例12: getBuffer

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public CirculinearDomain2D getBuffer(double dist) {
	return new GenericCirculinearDomain2D(
			new Circle2D(this, Math.abs(dist), dist>0));
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:5,代码来源:Point2D.java


示例13: render

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
@Override
public Shape render(E area, Graphics2D g, ScreenTransform t) {
    java.util.List<Edge> edges = area.getEdges();
    if (edges.isEmpty()) {
        return null;
    }

    int count = edges.size();
    int[] xs = new int[count];
    int[] ys = new int[count];
    int i = 0;
    for (Edge e : edges) {
        xs[i] = t.xToScreen(e.getStartX());
        ys[i] = t.yToScreen(e.getStartY());
        ++i;
    }
    Polygon shape = new Polygon(xs, ys, count);

    paintShape(area, shape, g);

    if (drawOverAllData
            && (StaticViewProperties.selectedObject == null || !agentEntitiesMap.containsKey(StaticViewProperties.selectedObject.getID()))) {
        if (overallEntities.contains(area.getID().getValue())) {
            paintData(area, shape, g);
        }
    } else if (StaticViewProperties.selectedObject != null
            && agentEntitiesMap.containsKey(StaticViewProperties.selectedObject.getID())
            && agentEntitiesMap.get(StaticViewProperties.selectedObject.getID()).contains(area.getID().getValue())) {
        paintData(area, shape, g);
    }

    if (area.equals(StaticViewProperties.selectedObject)) {
        Circle2D circle2D = new Circle2D(t.xToScreen(area.getX()), t.yToScreen(area.getY()), 18d);
        circle2D.draw(g);
    }

    for (Edge edge : edges) {
        paintEdge(edge, g, t);
    }
    return shape;
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:42,代码来源:MrlBaseAreaLayer.java


示例14: defaultCircle

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
protected void defaultCircle(Human h, Graphics2D g, ScreenTransform t) {
    Circle2D circle2D = new Circle2D(t.xToScreen(h.getX()), t.yToScreen(h.getY()), 18d, true);
    circle2D.draw(g);
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:5,代码来源:MrlBaseAnimatedHumanLayer.java


示例15: render

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
@Override
    public Shape render(E area, Graphics2D g, ScreenTransform t) {
        java.util.List<Edge> edges = area.getEdges();
        if (edges.isEmpty()) {
            return null;
        }

        int count = edges.size();
        int[] xs = new int[count];
        int[] ys = new int[count];
        int i = 0;
        for (Edge e : edges) {
            xs[i] = t.xToScreen(e.getStartX());
            ys[i] = t.yToScreen(e.getStartY());
            ++i;
        }
        Polygon shape = new Polygon(xs, ys, count);

        paintShape(area, shape, g);

        if (drawOverAllData
                && (StaticViewProperties.selectedObject == null || !agentEntitiesMap.containsKey(StaticViewProperties.selectedObject.getID()))) {
            if (overallEntities.contains(new BuildingDto(area.getID().getValue()))) {
//                paintData(area, shape, g);
            }
        } else {
            if (StaticViewProperties.selectedObject != null) {
                Map<Integer, BuildingDto> maps = agentEntitiesMap.get(StaticViewProperties.selectedObject.getID());
                if (agentEntitiesMap.containsKey(StaticViewProperties.selectedObject.getID())
                        && maps.keySet().contains(area.getID().getValue())) {
                    BuildingDto buildingDto = maps.get(area.getID().getValue());
                    paintData(area, (K) buildingDto, shape, g);
                }
            }
        }

        if (area.equals(StaticViewProperties.selectedObject)) {
            Circle2D circle2D = new Circle2D(t.xToScreen(area.getX()), t.yToScreen(area.getY()), 18d);
            circle2D.draw(g);
        }

        for (Edge edge : edges) {
            paintEdge(edge, g, t);
        }
        return shape;
    }
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:47,代码来源:MrlBaseAreaDtoLayer.java


示例16: create

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public static CircleInversion2D create(Circle2D circle) {
	return new CircleInversion2D(circle);
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:4,代码来源:CircleInversion2D.java


示例17: CircleInversion2D

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public CircleInversion2D(Circle2D circle) {
    this.center = circle.center();
    this.radius = circle.radius();
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:5,代码来源:CircleInversion2D.java


示例18: findIntersections

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
/**
 * Computes the intersections, if they exist, of two circulinear elements.
 */
public static Collection<Point2D> findIntersections(
		CirculinearElement2D elem1, CirculinearElement2D elem2) {

	// find which shapes are linear
	boolean b1 = elem1 instanceof LinearShape2D;
	boolean b2 = elem2 instanceof LinearShape2D;
	
	// if both elements are linear, check parallism to avoid computing
	// intersection of parallel lines
	if (b1 && b2) {
		LinearShape2D line1 = (LinearShape2D) elem1;
		LinearShape2D line2 = (LinearShape2D) elem2;
		
		// test parallel elements
		Vector2D v1 = line1.direction(); 
		Vector2D v2 = line2.direction(); 
		if (Vector2D.isColinear(v1, v2))
			return new ArrayList<Point2D>(0);
		
		return line1.intersections(line2);
	}
	
	// First try to use linear shape methods
	if (elem1 instanceof LinearShape2D) {
		return elem2.intersections((LinearShape2D) elem1);
	}
	if (elem2 instanceof LinearShape2D) {
		return elem1.intersections((LinearShape2D) elem2);
	}

	// From now, both elem1 and elem2 are instances of CircleShape2D
	// It is therefore possible to extract support circles
	Circle2D circ1 = ((CircularShape2D) elem1).supportingCircle();
	Circle2D circ2 = ((CircularShape2D) elem2).supportingCircle();

	// create array for storing result (max 2 possible intersections)
	ArrayList<Point2D> pts = new ArrayList<Point2D>(2);

	// for each of the circle intersections, check if they belong to
	// both elements
	for (Point2D inter : Circle2D.circlesIntersections(circ1, circ2)) {
		if (elem1.contains(inter) && elem2.contains(inter))
			pts.add(inter);
	}

	// return found intersections
	return pts;
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:52,代码来源:CirculinearCurves2D.java


示例19: buffer

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
public CirculinearDomain2D buffer(double dist) {
    return new GenericCirculinearDomain2D(new Circle2D(this,
            Math.abs(dist), dist > 0));
}
 
开发者ID:pokowaka,项目名称:android-geom,代码行数:5,代码来源:Point2D.java


示例20: getCircleDomain

import math.geom2d.conic.Circle2D; //导入依赖的package包/类
/**
 * Create a circular domain with the reference located in the lower left
 *
 * @param r
 * @return
 */
public static CirculinearCurve2D getCircleDomain(double r) {
    return new Circle2D(r, r, r);
}
 
开发者ID:rvt,项目名称:cnctools,代码行数:10,代码来源:FacingHelper.java



注:本文中的math.geom2d.conic.Circle2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XAttr类代码示例发布时间:2022-05-23
下一篇:
Java GroupConverter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap