Message Boards Message Boards

0
|
4291 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

RegionDistance and SignedRegionDistance do not work with Polyhedron objects

Consider this simple example (tested in Mathematica 12.0 and 12.1):

triangulatedfaces = {{{0.96061304173482298107700216860393993556`10., 
    0.45331546030854047435454390324593987316`10., 
    0.49359205573796699484390160250768531114`10.}, \
{0.73084004010743375268077670625643804669`10., 
    0.74870596934463617966315496232709847391`10., 
    0.42952723572831885689993214327841997147`10.}, \
{0.43334606124448857077024372405987991524`10., 
    0.41689319196522271064517626870821878672`10., 
    0.45817105631011349367408683026466271084`10.}}, \
{{0.73084004010743375268077670625643804669`10., 
    0.74870596934463617966315496232709847391`10., 
    0.42952723572831885689993214327841997147`10.}, \
{0.15756394918966518114977759523753775284`10., 
    0.89301676609471791756789116334402933717`10., 
    0.4037575264860177037817834388988558203`10.}, \
{0.43334606124448857077024372405987991524`10., 
    0.41689319196522271064517626870821878672`10., 
    0.45817105631011349367408683026466271084`10.}}, \
{{0.15756394918966518114977759523753775284`10., 
    0.89301676609471791756789116334402933717`10., 
    0.4037575264860177037817834388988558203`10.}, \
{-0.01645930097046247042591460285620996729`10., 
    0.43252280089173278376790676702512428164`10., 
    0.41271457151521584449938018224202096462`10.}, \
{0.43334606124448857077024372405987991524`10., 
    0.41689319196522271064517626870821878672`10., 
    0.45817105631011349367408683026466271084`10.}}, \
{{-0.01645930097046247042591460285620996729`10., 
    0.43252280089173278376790676702512428164`10., 
    0.41271457151521584449938018224202096462`10.}, \
{0.14379330009296495407333793536963639781`10., 
    0.02310394547537703360817751274680631468`10., 
    0.58101409060754916069413411605637520552`10.}, \
{0.43334606124448857077024372405987991524`10., 
    0.41689319196522271064517626870821878672`10., 
    0.45817105631011349367408683026466271084`10.}}, \
{{0.14379330009296495407333793536963639781`10., 
    0.02310394547537703360817751274680631468`10., 
    0.58101409060754916069413411605637520552`10.}, \
{0.62068324671781538448556148068746551871`10., \
-0.04109172049086395883676914309035055339`10., 
    0.43668220311461170002331755313207395375`10.}, \
{0.43334606124448857077024372405987991524`10., 
    0.41689319196522271064517626870821878672`10., 
    0.45817105631011349367408683026466271084`10.}}, \
{{0.62068324671781538448556148068746551871`10., \
-0.04109172049086395883676914309035055339`10., 
    0.43668220311461170002331755313207395375`10.}, \
{0.96061304173482298107700216860393993556`10., 
    0.45331546030854047435454390324593987316`10., 
    0.49359205573796699484390160250768531114`10.}, \
{0.43334606124448857077024372405987991524`10., 
    0.41689319196522271064517626870821878672`10., 
    0.45817105631011349367408683026466271084`10.}}, \
{{0.90339887001981922232118904503295198083`10., 
    0.39780535114134973895261282450519502163`10., \
-0.49767982164323409932649155962280929089`10.}, \
{0.67343203811032026351313106715679168701`10., \
-0.00722531137087333019675128298331401311`10., \
-0.50724543215112882776907099469099193811`10.}, \
{0.45426437662895290009900361709085829827`10., 
    0.40378644682349356267746071075992878195`10., \
-0.51720634068240571283482954794751634587`10.}}, \
{{0.67343203811032026351313106715679168701`10., \
-0.00722531137087333019675128298331401311`10., \
-0.50724543215112882776907099469099193811`10.}, \
{0.22606705517260500259979494330764282495`10., \
-0.03684675096394777332742265230081102345`10., \
-0.54603854328090140057838652865029871464`10.}, \
{0.45426437662895290009900361709085829827`10., 
    0.40378644682349356267746071075992878195`10., \
-0.51720634068240571283482954794751634587`10.}}, \
{{0.22606705517260500259979494330764282495`10., \
-0.03684675096394777332742265230081102345`10., \
-0.54603854328090140057838652865029871464`10.}, \
{0.03823756877052398445160363849026907701`10., 
    0.53807966207547353043594284827122464776`10., \
-0.4918195240731523809607494968076935038`10.}, \
{0.45426437662895290009900361709085829827`10., 
    0.40378644682349356267746071075992878195`10., \
-0.51720634068240571283482954794751634587`10.}}, \
{{0.03823756877052398445160363849026907701`10., 
    0.53807966207547353043594284827122464776`10., \
-0.4918195240731523809607494968076935038`10.}, \
{0.23068196447687261407821779357618652284`10., 
    0.82936478255809309434454235088196583092`10., \
-0.49236745013861882291905658348696306348`10.}, \
{0.45426437662895290009900361709085829827`10., 
    0.40378644682349356267746071075992878195`10., \
-0.51720634068240571283482954794751634587`10.}}, \
{{0.23068196447687261407821779357618652284`10., 
    0.82936478255809309434454235088196583092`10., \
-0.49236745013861882291905658348696306348`10.}, \
{0.63673291554919675405699308612383902073`10., 
    0.83167834849230060090263805250287987292`10., \
-0.56145887784959491728642433372442610562`10.}, \
{0.45426437662895290009900361709085829827`10., 
    0.40378644682349356267746071075992878195`10., \
-0.51720634068240571283482954794751634587`10.}}, \
{{0.63673291554919675405699308612383902073`10., 
    0.83167834849230060090263805250287987292`10., \
-0.56145887784959491728642433372442610562`10.}, \
{0.90339887001981922232118904503295198083`10., 
    0.39780535114134973895261282450519502163`10., \
-0.49767982164323409932649155962280929089`10.}, \
{0.45426437662895290009900361709085829827`10., 
    0.40378644682349356267746071075992878195`10., \
-0.51720634068240571283482954794751634587`10.}}, \
{{0.96061304173482298107700216860393993556`10., 
    0.45331546030854047435454390324593987316`10., 
    0.49359205573796699484390160250768531114`10.}, \
{0.90339887001981922232118904503295198083`10., 
    0.39780535114134973895261282450519502163`10., \
-0.49767982164323409932649155962280929089`10.}, \
{0.80595527927073690300953750885886848367`10., 
    0.60847346983126092536623759112007511912`10., \
-0.05698734323802226018864065147245038359`10.}}, \
{{0.90339887001981922232118904503295198083`10., 
    0.39780535114134973895261282450519502163`10., \
-0.49767982164323409932649155962280929089`10.}, \
{0.63673291554919675405699308612383902073`10., 
    0.83167834849230060090263805250287987292`10., \
-0.56145887784959491728642433372442610562`10.}, \
{0.80595527927073690300953750885886848367`10., 
    0.60847346983126092536623759112007511912`10., \
-0.05698734323802226018864065147245038359`10.}}, \
{{0.63673291554919675405699308612383902073`10., 
    0.83167834849230060090263805250287987292`10., \
-0.56145887784959491728642433372442610562`10.}, \
{0.73084004010743375268077670625643804669`10., 
    0.74870596934463617966315496232709847391`10., 
    0.42952723572831885689993214327841997147`10.}, \
{0.80595527927073690300953750885886848367`10., 
    0.60847346983126092536623759112007511912`10., \
-0.05698734323802226018864065147245038359`10.}}, \
{{0.73084004010743375268077670625643804669`10., 
    0.74870596934463617966315496232709847391`10., 
    0.42952723572831885689993214327841997147`10.}, \
{0.96061304173482298107700216860393993556`10., 
    0.45331546030854047435454390324593987316`10., 
    0.49359205573796699484390160250768531114`10.}, \
{0.80595527927073690300953750885886848367`10., 
    0.60847346983126092536623759112007511912`10., \
-0.05698734323802226018864065147245038359`10.}}, \
{{0.73084004010743375268077670625643804669`10., 
    0.74870596934463617966315496232709847391`10., 
    0.42952723572831885689993214327841997147`10.}, \
{0.63673291554919675405699308612383902073`10., 
    0.83167834849230060090263805250287987292`10., \
-0.56145887784959491728642433372442610562`10.}, \
{0.44750375627034217646135424890508150508`10., 
    0.82419990224878614722338630170340625964`10., \
-0.02628326583337650328502614760731471431`10.}}, \
{{0.63673291554919675405699308612383902073`10., 
    0.83167834849230060090263805250287987292`10., \
-0.56145887784959491728642433372442610562`10.}, \
{0.23068196447687261407821779357618652284`10., 
    0.82936478255809309434454235088196583092`10., \
-0.49236745013861882291905658348696306348`10.}, \
{0.44750375627034217646135424890508150508`10., 
    0.82419990224878614722338630170340625964`10., \
-0.02628326583337650328502614760731471431`10.}}, \
{{0.23068196447687261407821779357618652284`10., 
    0.82936478255809309434454235088196583092`10., \
-0.49236745013861882291905658348696306348`10.}, \
{0.15756394918966518114977759523753775284`10., 
    0.89301676609471791756789116334402933717`10., 
    0.4037575264860177037817834388988558203`10.}, \
{0.44750375627034217646135424890508150508`10., 
    0.82419990224878614722338630170340625964`10., \
-0.02628326583337650328502614760731471431`10.}}, \
{{0.15756394918966518114977759523753775284`10., 
    0.89301676609471791756789116334402933717`10., 
    0.4037575264860177037817834388988558203`10.}, \
{0.73084004010743375268077670625643804669`10., 
    0.74870596934463617966315496232709847391`10., 
    0.42952723572831885689993214327841997147`10.}, \
{0.44750375627034217646135424890508150508`10., 
    0.82419990224878614722338630170340625964`10., \
-0.02628326583337650328502614760731471431`10.}}, \
{{0.15756394918966518114977759523753775284`10., 
    0.89301676609471791756789116334402933717`10., 
    0.4037575264860177037817834388988558203`10.}, \
{0.23068196447687261407821779357618652284`10., 
    0.82936478255809309434454235088196583092`10., \
-0.49236745013861882291905658348696306348`10.}, \
{0.10040396327093701075588669595812337407`10., 
    0.67190499440378873685596373849953326928`10., \
-0.01763262562508092381944738006955938542`10.}}, \
{{0.23068196447687261407821779357618652284`10., 
    0.82936478255809309434454235088196583092`10., \
-0.49236745013861882291905658348696306348`10.}, \
{0.03823756877052398445160363849026907701`10., 
    0.53807966207547353043594284827122464776`10., \
-0.4918195240731523809607494968076935038`10.}, \
{0.10040396327093701075588669595812337407`10., 
    0.67190499440378873685596373849953326928`10., \
-0.01763262562508092381944738006955938542`10.}}, \
{{0.03823756877052398445160363849026907701`10., 
    0.53807966207547353043594284827122464776`10., \
-0.4918195240731523809607494968076935038`10.}, \
{-0.01645930097046247042591460285620996729`10., 
    0.43252280089173278376790676702512428164`10., 
    0.41271457151521584449938018224202096462`10.}, \
{0.10040396327093701075588669595812337407`10., 
    0.67190499440378873685596373849953326928`10., \
-0.01763262562508092381944738006955938542`10.}}, \
{{-0.01645930097046247042591460285620996729`10., 
    0.43252280089173278376790676702512428164`10., 
    0.41271457151521584449938018224202096462`10.}, \
{0.15756394918966518114977759523753775284`10., 
    0.89301676609471791756789116334402933717`10., 
    0.4037575264860177037817834388988558203`10.}, \
{0.10040396327093701075588669595812337407`10., 
    0.67190499440378873685596373849953326928`10., \
-0.01763262562508092381944738006955938542`10.}}, \
{{-0.01645930097046247042591460285620996729`10., 
    0.43252280089173278376790676702512428164`10., 
    0.41271457151521584449938018224202096462`10.}, \
{0.03823756877052398445160363849026907701`10., 
    0.53807966207547353043594284827122464776`10., \
-0.4918195240731523809607494968076935038`10.}, \
{0.10552001495081394438994750706155363302`10., 
    0.22242517263409444008047462276936715858`10., \
-0.03123196218993484001438174680202227369`10.}}, \
{{0.03823756877052398445160363849026907701`10., 
    0.53807966207547353043594284827122464776`10., \
-0.4918195240731523809607494968076935038`10.}, \
{0.22606705517260500259979494330764282495`10., \
-0.03684675096394777332742265230081102345`10., \
-0.54603854328090140057838652865029871464`10.}, \
{0.10552001495081394438994750706155363302`10., 
    0.22242517263409444008047462276936715858`10., \
-0.03123196218993484001438174680202227369`10.}}, \
{{0.22606705517260500259979494330764282495`10., \
-0.03684675096394777332742265230081102345`10., \
-0.54603854328090140057838652865029871464`10.}, \
{0.14379330009296495407333793536963639781`10., 
    0.02310394547537703360817751274680631468`10., 
    0.58101409060754916069413411605637520552`10.}, \
{0.10552001495081394438994750706155363302`10., 
    0.22242517263409444008047462276936715858`10., \
-0.03123196218993484001438174680202227369`10.}}, \
{{0.14379330009296495407333793536963639781`10., 
    0.02310394547537703360817751274680631468`10., 
    0.58101409060754916069413411605637520552`10.}, \
{-0.01645930097046247042591460285620996729`10., 
    0.43252280089173278376790676702512428164`10., 
    0.41271457151521584449938018224202096462`10.}, \
{0.10552001495081394438994750706155363302`10., 
    0.22242517263409444008047462276936715858`10., \
-0.03123196218993484001438174680202227369`10.}}, \
{{0.14379330009296495407333793536963639781`10., 
    0.02310394547537703360817751274680631468`10., 
    0.58101409060754916069413411605637520552`10.}, \
{0.22606705517260500259979494330764282495`10., \
-0.03684675096394777332742265230081102345`10., \
-0.54603854328090140057838652865029871464`10.}, \
{0.40125467931090727187015656454456311419`10., \
-0.01487274791839898910715736766805434734`10., 
    0.00166485845898677538167401721222930712`10.}}, \
{{0.22606705517260500259979494330764282495`10., \
-0.03684675096394777332742265230081102345`10., \
-0.54603854328090140057838652865029871464`10.}, \
{0.67343203811032026351313106715679168701`10., \
-0.00722531137087333019675128298331401311`10., \
-0.50724543215112882776907099469099193811`10.}, \
{0.40125467931090727187015656454456311419`10., \
-0.01487274791839898910715736766805434734`10., 
    0.00166485845898677538167401721222930712`10.}}, \
{{0.67343203811032026351313106715679168701`10., \
-0.00722531137087333019675128298331401311`10., \
-0.50724543215112882776907099469099193811`10.}, \
{0.62068324671781538448556148068746551871`10., \
-0.04109172049086395883676914309035055339`10., 
    0.43668220311461170002331755313207395375`10.}, \
{0.40125467931090727187015656454456311419`10., \
-0.01487274791839898910715736766805434734`10., 
    0.00166485845898677538167401721222930712`10.}}, \
{{0.62068324671781538448556148068746551871`10., \
-0.04109172049086395883676914309035055339`10., 
    0.43668220311461170002331755313207395375`10.}, \
{0.14379330009296495407333793536963639781`10., 
    0.02310394547537703360817751274680631468`10., 
    0.58101409060754916069413411605637520552`10.}, \
{0.40125467931090727187015656454456311419`10., \
-0.01487274791839898910715736766805434734`10., 
    0.00166485845898677538167401721222930712`10.}}, \
{{0.62068324671781538448556148068746551871`10., \
-0.04109172049086395883676914309035055339`10., 
    0.43668220311461170002331755313207395375`10.}, \
{0.67343203811032026351313106715679168701`10., \
-0.00722531137087333019675128298331401311`10., \
-0.50724543215112882776907099469099193811`10.}, \
{0.79187734517734790351151397235961512986`10., 
    0.20456872448860752990734564624709197414`10., 
    0.00360399339447874917143676987045118303`10.}}, \
{{0.67343203811032026351313106715679168701`10., \
-0.00722531137087333019675128298331401311`10., \
-0.50724543215112882776907099469099193811`10.}, \
{0.90339887001981922232118904503295198083`10., 
    0.39780535114134973895261282450519502163`10., \
-0.49767982164323409932649155962280929089`10.}, \
{0.79187734517734790351151397235961512986`10., 
    0.20456872448860752990734564624709197414`10., 
    0.00360399339447874917143676987045118303`10.}}, \
{{0.90339887001981922232118904503295198083`10., 
    0.39780535114134973895261282450519502163`10., \
-0.49767982164323409932649155962280929089`10.}, \
{0.96061304173482298107700216860393993556`10., 
    0.45331546030854047435454390324593987316`10., 
    0.49359205573796699484390160250768531114`10.}, \
{0.79187734517734790351151397235961512986`10., 
    0.20456872448860752990734564624709197414`10., 
    0.00360399339447874917143676987045118303`10.}}, \
{{0.96061304173482298107700216860393993556`10., 
    0.45331546030854047435454390324593987316`10., 
    0.49359205573796699484390160250768531114`10.}, \
{0.62068324671781538448556148068746551871`10., \
-0.04109172049086395883676914309035055339`10., 
    0.43668220311461170002331755313207395375`10.}, \
{0.79187734517734790351151397235961512986`10., 
    0.20456872448860752990734564624709197414`10., 
    0.00360399339447874917143676987045118303`10.}}};

Now I convert the triangulated faces into a Polyhedron

poly = Polyhedron[triangulatedpoly]

this successfully converts the faces into a polyhedron, which passes the RegionQ and ConstantRegionQ test

{ConstantRegionQ[poly], RegionQ[poly]}
(* {True,True} *)

However, RegionDistance or SignedRegionDistance cannot be used on poly to check the distance of a point from a polyhedron. RegionMember cannot be used as well. All these evaluations do not return a function. With these functions not working many useful computations cannot be performed with Polyhedrons.

Hope this issue gets resolved in the upcoming version.

This issue was also reported on Mathematica StackExchange: https://mathematica.stackexchange.com/questions/221491/regiondistance-and-signedregiondistance-do-not-work-with-polyhedron-objects

POSTED BY: Ali Hashmi
2 Replies

With Polygon instead of Polyhedron we get a distance:

In[119]:= RegionDistance[Polygon[triangulatedfaces], {1, 1, 1}]

Out[119]= 0.676006498

For points outside the polyhedron it may suffice. Unfortunately, RegionMember also fails for this polyhedron:

RegionMember[Polyhedron[triangulatedfaces], {1/2, 1/2, 0}]
POSTED BY: Gianluca Gorni

Yeah. I hope these functionalities can be extended for Polyhedron. Because currently I am quite limited in the computation that I can perform on them.

POSTED BY: Ali Hashmi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract