标签: convex

3D中的Alpha形状

除了CGAL python绑定之外,python中的3维中是否存在“ alpha形状”函数?

或者,是否可以将下面的示例扩展到3D中?

2D示例:在matplotlib中,在散点图中的数据点周围绘制平滑多边形

我目前正在使用此ConvexHull示例计算体积,但出于我的目的,由于“凸”约束而使体积膨胀。

谢谢,

python numpy convex-hull convex concave-hull

5
推荐指数
1
解决办法
1797
查看次数

Libgdx 多边形三角剖分

好的,所以我有一个多边形(简单但凹形),我试图将其切成三角形以使其与其他多边形碰撞。

我知道我的多边形是凹面的,所以我决定使用 LibGDX EarClippingTriangulator来设法将它切成三角形。

所以,通过这段代码,我得到了我的三角形顶点:

public void triangulate()
    {
        Vector<float[]> trianglesVertices = new Vector<float[]>();
        ShortArray pointsCoords = new ShortArray();
        EarClippingTriangulator triangulator = new EarClippingTriangulator();

        // Cut in triangles
        pointsCoords = triangulator.computeTriangles(this.getTransformedVertices());

        // Make triangles
        for (int i = 0; i < pointsCoords.size / 6; i++)
        {
            trianglesVertices.add(new float[] {
                    pointsCoords.get(i), pointsCoords.get(i+1),
                    pointsCoords.get(i+2), pointsCoords.get(i+3),
                    pointsCoords.get(i+4), pointsCoords.get(i+5),
            });
            Polygon triangle = new Polygon(trianglesVertices.get(i));
            triangles.add(triangle);
        }

        System.out.printf("Triangulation made %d triangles.\n", pointsCoords.size / 6);
    }
Run Code Online (Sandbox Code Playgroud)

但是当我尝试绘制我刚刚制作的那些三角形时,它们只是在 0,0 坐标中堆叠......而且,所有三角形看起来几乎相同是否正常,我的意思是它们都有相同的方向?

我没有找到太多关于 libgdx 的这种截断用途的信息你能帮忙吗?

(对不起我的英语我是法国人,对不起没有照片,我在这里太年轻了)

编辑: …

polygon concave triangulation convex libgdx

5
推荐指数
2
解决办法
1713
查看次数

如何确定多面体是否凸出?

我正在寻找一种有效的算法来确定多面体是否凸出.

我开始检查欧拉特征是2.我还检查每个面都是凸面的.但这仍然没有抓住很多案例.

c# convex polyhedra

5
推荐指数
2
解决办法
885
查看次数

求凸多边形的最大 y 坐标

我有一个 array V[1,2,....,n],其中数组的每个元素代表坐标对 (x,y) 形式的凸多边形的顶点。

\n\n

已知V[1]是具有最小 x 坐标的顶点,并且顶点V[1,2,....,n]按逆时针顺序排列,如 \xef\xac\x81gure 中所示。还假定顶点的 x 坐标都是不同的,顶点的 y 坐标也是不同的。\n在此输入图像描述

\n\n

现在,我想找到具有最大 y 坐标值的顶点。我们都知道简单的 O(n) 方法,但是有可能在 O(log(n)) 中找到它吗?

\n\n

我使用具有最小 x 坐标的顶点的信息V[1]在 O(log(n)) 时间内找到具有最大 x 坐标的顶点。但是是否可以实现最大 y 坐标呢?

\n\n

谢谢您的帮助!

\n

algorithm geometry max convex convex-polygon

5
推荐指数
1
解决办法
2726
查看次数

具有共线点的礼品包装算法

因此,我根据用于查找一组点的凸包的礼品包装算法示例编写了以下代码:

std::vector<sf::Vector2f> convexHull(const std::vector<sf::Vector2f>& _shape)
{
    std::vector<sf::Vector2f> returnValue;    
    returnValue.push_back(leftmostPoint(_shape));
    for (std::vector<sf::Vector2f>::const_iterator it = _shape.begin(), end = _shape.end(); it != end; ++it)
    {
        if (elementIncludedInVector(*it, returnValue)) continue;
        bool allPointWereToTheLeft = true;
        for (std::vector<sf::Vector2f>::const_iterator it1 = _shape.begin(); it1 != end; ++it1)
        {
            if (*it1 == *it || elementIncludedInVector(*it1, returnValue)) continue;
            if (pointPositionRelativeToLine(returnValue.back(), *it, *it1) > 0.0f)
            {
                allPointWereToTheLeft = false;
                break;
            }
        }
        if (allPointWereToTheLeft)
        {
            returnValue.push_back(*it);
            it = _shape.begin();
        }
    }
    return returnValue;
}
Run Code Online (Sandbox Code Playgroud)

这是我用于确定第三个点位于线的哪一侧的函数:

float pointPositionRelativeToLine(const sf::Vector2f& A, const sf::Vector2f& …
Run Code Online (Sandbox Code Playgroud)

c++ algorithm geometry convex

4
推荐指数
1
解决办法
1859
查看次数

Logistic回归中成本函数的局部和全局最小值

在对逻辑回归公式的推导中,我误解了最小值背后的想法。

想法是尽可能增加假设(即,正确的预测概率尽可能接近1),这反过来又要求尽可能降低成本函数$ J(\ theta)$。

现在,我被告知要使所有这些工作正常进行,成本函数必须是凸的。我对凸性的理解要求没有最大值,因此只能有一个最小值,即全局最小值。真的是这样吗?如果不是,请说明原因。另外,如果不是这种情况,则意味着成本函数中可能存在多个最小值,这意味着多组参数会产生越来越高的概率。这可能吗?还是可以确定返回的参数引用了全局最小值,因此是最高的概率/预测?

machine-learning convex-optimization convex logistic-regression

4
推荐指数
1
解决办法
3982
查看次数

凸壳:已知的点数但不是点本身

我需要找到一种算法,该算法根据给定的一组S大小点计算凸包n.我知道有刚好6点,S形成的凸包.

计算这个的最佳和最有效的方法是什么?

我想要生成所有可能的点组合S(这将是n选择6点),这将采用O(n ^ 6),然后检查这是否是一个凸包,这将采取O(n)但导致一个非常总运行时间不好.肯定有更好的办法.任何提示?

algorithm geometry convex-hull convex computational-geometry

1
推荐指数
1
解决办法
164
查看次数

什么是凸优化的dotnet库?

你会推荐任何凸优化库吗?

理想的开源.半定规划和QCQP的先验.

(我打算用fsharp和任何dotnet一起使用它)

.net optimization f# convex-optimization convex

0
推荐指数
1
解决办法
454
查看次数

绕组数算法和凸点边界/边缘上的点

我需要一种算法,它可以判断Point是否位于凸包(C / C ++)的内部/外部或边界(边缘)上。

凸包被描述为点X,Y,整数,连接从i到i + 1的数组。

目前,我使用绕组数算法,描述如下:http : //geomalgorithms.com/a03-_inclusion.html它是函数“ wn_PnPoly()”。

如果Point正好位于凸面的边界(边缘)上,是否有可能以及如何使绕组数算法检测到?还有另一种算法可以做到这一点吗?(需要在整数上工作)。

c++ algorithm convex point-in-polygon

0
推荐指数
1
解决办法
3182
查看次数