Cone containing set of points
Mostra commenti meno recenti
I want to enforce the constraint : " the cone with apex P and opening angle of theta must coontains point1 and point2 " P is the decision variable i need to find the cone that contains those 2 points, is there some suggestion on how to write this constraint ?
1 Commento
Manikanta Aditya
il 8 Apr 2024
Hi,
The constraint you’re trying to enforce can be expressed mathematically using the dot product and the definition of a cone.
Check this example to get more better understanding:
% Define the points and the apex of the cone
P = [Px, Py, Pz]; % the apex of the cone
point1 = [x1, y1, z1];
point2 = [x2, y2, z2];
% Calculate the vectors from P to the points
v1 = point1 - P;
v2 = point2 - P;
% Calculate the cosine of the angle between the vectors
cos_angle = dot(v1, v2) / (norm(v1) * norm(v2));
% Check if the points are within the cone
if cos_angle > cosd(theta)
disp('The points are within the cone.')
else
disp('The points are not within the cone.')
end
Thanks.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Linear Programming and Mixed-Integer Linear Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!