1
$\begingroup$

I want to check whether a given point is also a member of the edges of a given conical hull.

For example, I have:

\[ScriptCapitalR] = ConicHullRegion[{0, 0, 0}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}},Transpose[{{1, 0}, {-1, 1}, {1, -1}}]];

The region is described symbolically as:

RegionMember[\[ScriptCapitalR], {x, y, z}] 

This gives output (x | y | z) \[Element] Reals && -x <= 0 && -x - y <= 0 && y + z == 0

The region is thus:

enter image description here

My question is then, how do you check whether a vector, say {1,0,0}, also belongs to one of the edges of the graph (i.e. lies in the boundary)?

I tried using:

\[ScriptCapitalS] = RegionBoundary[\[ScriptCapitalR]];
RegionMember[\[ScriptCapitalS], {1, 0, 0} ]

However, this gives me "True", as the boundary seems to be the same as the original region. I want it to strictly check for the edges, so want strict inclusion inside the region. I would expect such a method to give me false for the given vector above, because $1 \neq 0$.

Edit: Sorry I keep deleting/undeleting, I thought I had this resolved but I am still having issues.

Edit: This seems to be related to the problem of checking whether a 3D point lies within a planar polygon. I have looked at:

How to check if a 3D point is in a planar polygon?

However, I am still stuck on how I could potentially use this.

$\endgroup$
  • $\begingroup$ RegionBoundary applied to a lower dimensional region will always return the same region (see the second bullet point in the Details section here). By boundary do you mean RegionUnion[HalfLine[{0, 0, 0}, {1, -1, 1}], HalfLine[{0, 0, 0}, {0, 1, -1}]]? $\endgroup$ – Chip Hurst Sep 9 at 11:55
  • $\begingroup$ Hi, sorry for the late reply. Yes, I was running into the same issue. I think I understand what my mistake was. Thanks! $\endgroup$ – LordVader007 Sep 15 at 5:49
2
+100
$\begingroup$

If you draw the region with the vectors it should hopefully become more easy to figure out what to do.

From the documentation, a point is on the region if it can be expressed as: $$ p+s_1 v_1+\cdots +s_mv_m +t_1 w_1+\cdots +t_n w_n|s_i\in \mathbb{R}\land t_j\geq 0 $$ ... and in your case $p$ is the origin and all the $v_i$ are zero. Therefore, to show a point is on the region you need only find a solution to the positive $t_i$. A point is on the edge of a region if it can be expressed as above with at most one $t_j$ positive and all other $t_i$ zero.

Remove["Global`*"]
w1 = {1, -1, 1};
w2 = {0, 1, -1};
p0 = {0, 0, 0};
r = ConicHullRegion[p0, ConstantArray[0,{3,3}], {w1,w2}];
Graphics3D[{Red, Arrow[{p0, p0+w1}], Arrow[{p0, p0+w2}], Gray,
   Opacity[.5], r}, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}, Boxed -> False]

conic hull

The point {1,0,0} for example, can now be expressed in terms of the vectors by a LinearSolve:

LinearSolve[Transpose[{w1, w2}], {1,0,0} - p0]
(* result: {1,1} *)

... meaning {1,0,0} is 1*w1 + 1*w2. This point is not on the edge because both values are positive. For the point {7,-7,7} we have:

LinearSolve[Transpose[{w1, w2}], {7,-7,7} - p0]
(* result: {7,0} *)

This point is on the edge because there is only one positive nonzero value.

If there is no solution then the point is not on the region at all. If there are negative values in the solution, then it's not on the region but in the same plane. The following function should do most of what you need:

onEdge[point_, {p_, vecs_}] := 
 With[{sol=Quiet[Check[LinearSolve[Transpose[vecs], point - p], {-1}], 
  LinearSolve::nosol]},
  AllTrue[sol, NonNegative] && Count[sol, x_ /; Positive[x]] <= 1
]

(* examples: *)
onEdge[{3,-3,3}, {p0,{w1, w2}}]
(* result: True *)

onEdge[{1,2,3}, {p0,{w1, w2}}]
(* result: False *)

onEdge[{0,0,0}, {p0,{w1, w2}}]
(* result: True *)

onEdge[{5,-8,8}, {p0,{w1, w2}}]
(* result: False*)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Note the other edges in the drawing that don't line up with the arrows are actually at infinity and don't really exist in any meaningful sense. $\endgroup$ – flinty Sep 9 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.