Clear Filters
Clear Filters

Want to check any point lied inside a closed isosurface or not?

2 views (last 30 days)
%Hellow everyone,
%I want to check whether any point inside of the TPMS structure or not example point K(0,0,0) point lies in that TPMS or not.Analytically point K(0,0,0) must be lies inside but according to the output it is showing outside. Kindly help me regarding this issue.
%clear all previous commands
clear all
close all
clc
SizeL = 5;
Def = 160;
SFact = (SizeL/2)/pi;
A = SFact*pi;
D = A/Def;
[X,Y,Z] = meshgrid(-A:D:A);
OBJ = cos (X/SFact)+cos (Y/SFact)+cos (Z/SFact) + (0);
T = 0;
OBJ = (OBJ);
[F1,V1] = isosurface (X,Y,Z,OBJ,0);
[F2,V2] = isocaps(X,Y,Z,OBJ,0,'above');
F3 = [F1;F2+length(V1(:,1))];
V3 = [V1;V2];
P = patch ('Vertices',V3, 'Faces',F3,'FaceColor','blue','EdgeColor','none');
K = [0 0 0];
in = intriangulation(V3,F3,K)
if in==0
fprintf("outside");
else
fprintf("inside");
end
view(3)
camlight
axis equal

Answers (1)

Vandit
Vandit on 30 Aug 2023
Hi,
The code you provided generates a TPMS structure using the isosurface function and checks if a given point K is inside or outside the structure but it seems that the generated TPMS structure is still not enclosing the origin or the point K as desired.
Here are a few possible reasons why the point K might be outside the TPMS structure:
  1. The TPMS function used in the code might not be suitable for generating a structure that encloses the origin or the point K. So try to explore a variety of TPMS functions and their characteristics. Look for functions that are known to generate structures with desired properties, such as enclosing specific points.
  2. The parameters used to define the TPMS structure, such as the scaling factor or amplitude, can affect the shape and behavior of the structure. Experimenting with different parameter values might help generate a TPMS structure that encloses the origin or the point K.
  3. You can try modifying the TPMS function itself to ensure that it encloses the origin or the point K. This might involve adjusting the mathematical expression or adding additional terms to the function.
  4. Instead of relying on a single TPMS function, you can consider using a combination of multiple TPMS functions to create a more complex structure that encloses the desired point.
To know more about TPMS Scaffold, refer to the documentation below:
Hope this helps.
Thankyou

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!