DiscussionsIssue archiveOther usage issues

Archived discussion

Point belongs to segment?

Other usage issuesFri, 12/06/2002 - 17:241 reply

Browse this forum
QuestionAuthor

Hello!

Is there a standard way to determine if point belongs to line segment bounded by 2 points?

Currently I project point to segment, calculate distance from initial point to projection point and compare it with Precision::Confusion().

Discussion

1 archived reply

Posts are displayed in their archived order.

01Commenter-1

Let's say your segment is between P1 and P2, and P is your point.

compute
gp_Vec V1(P,P1);
gp_Vec V2(P,P2);

Standard_Boolean PBelongToSeg = V1.IsParallel(V2,Precision::Angular());

HTH
compute the 2 gp_Vec from