- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我有一个点,并在 z 轴上创建一条线以查看与某个网格的交点(将网格上的点投影到 z 轴上)。
所以我创建了一个 vtkCellLocator,但是函数的每个参数是什么?文档中根本没有描述它:
int vtkCellLocator::IntersectWithLine(double a0[3], double a1[3], double tol,
double& t, double x[3], double pcoords[3],
int &subId, vtkIdType &cellId,
vtkGenericCell *cell);
我测试了一下,好像a0和a1是我们直线的端点,x是找到的交点值,cellid是交点的cellid。
剩下的是什么意思?如果我有多个交点会怎样?它如何从所有交点中选择“最佳”交点单元格?
最佳答案
IntersectWithLine 的参数派生自 vtkCell 类。有点埋没看详细说明here对于参数。 vtkCellLocator 中的实现使用对 vtkCell::IntersectWithLine
的调用来定义参数。
virtual int vtkCell::IntersectWithLine ( const double p1[3],const double p2[3], double tol, double & t, doublex[3], double pcoords[3], int & subId )
Intersect with a ray.
Return parametric coordinates (both line and cell) and globalintersection coordinates, given ray definition p1[3], p2[3] andtolerance tol. The method returns non-zero value if intersectionoccurs. A parametric distance t between 0 and 1 along the rayrepresenting the intersection point, the point coordinates x[3] indata coordinates and also pcoords[3] in parametric coordinates. subIdis the index within the cell if a composed cell like a triangle strip.
返回的 cellId 基于到相交单元格的参数化距离。所以返回的cellId就是最小化成员函数vtkCell::GetParametricDistance
virtual double vtkCell::GetParametricDistance ( const double pcoords[3] )
Return the distance of the parametric coordinate provided to thecell.
If inside the cell, a distance of zero is returned. This is usedduring picking to get the correct cell picked. (The tolerance willoccasionally allow cells to be picked who are not really intersected"inside" the cell.)
因此它应该是在公差范围内与最接近 p1
关于vtk - 如何在 vtk 中使用 IntersectWithLine 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41832596/
我有两个等值面(头骨和皮肤)。给定颅骨等面上的 A 点,我使用“double *pos = pickerCell->GetPickNormal()”计算 A 点的法线。当我打印 pos 时,这就是我得
所以我有一个点,并在 z 轴上创建一条线以查看与某个网格的交点(将网格上的点投影到 z 轴上)。 所以我创建了一个 vtkCellLocator,但是函数的每个参数是什么?文档中根本没有描述它: in
我有一个使用 vtkCylinderSource 生成的定向圆柱体,并对其应用了一些转换以获得我想要的方向。下面是创建这个定向圆柱体的代码: def cylinder_object(startPoin
我是一名优秀的程序员,十分优秀!