1
$\begingroup$

I would like to convert a very easy(examplary) mesh(2D)

Needs["NDSolve`FEM`"]
ToElementMesh["Coordinates" -> -{{0, 0}, {1, -.5}, {0.7, .8}, {0, 1}},
"MeshElements" -> {TriangleElement[{{1, 2, 3}, {1, 3, 4}}]}, 
"BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4,1}}]},
"PointElements" -> {PointElement[{{1}, {2}, {3}, \{4}}]}]["Wireframe"]

enter image description here

by changing the Coordinates(2D-3D) and assuming the 3Dmesh to be a boundary mesh:

ToBoundaryMesh[
"Coordinates" ->Map[{#[[1]], #[[2]], RandomReal[]} &, {{0,0}, {1, -.5}, {0.7, .8}, {0, 1}}],
"MeshElements" -> {TriangleElement[{{1, 2, 3}, {1, 3, 4}}]}, 
"BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4,1}}]} 
]["Wireframe"]

MMA evaluates the expression without error bur doesn't show the mesh!

What's going wrong here? Thanks

$\endgroup$
2
  • 2
    $\begingroup$ For 3D ToBoundaryMesh[rules] syntax you should pass surface elements to "BoundaryElements" rule and set "MeshElements"->Automatic. $\endgroup$
    – Pinti
    Oct 16, 2018 at 11:09
  • $\begingroup$ @Pinti Thank you, ToBoundaryMesh[ "Coordinates" -> Map[{#[[1]], #[[2]], RandomReal[]} &, {{0, 0}, {1, -.5}, {0.7, .8}, {0, 1}}], "BoundaryElements" -> {TriangleElement[{{1, 2, 3}, {1, 3, 4}}]}]["Wireframe"] works without MeshElement! $\endgroup$ Oct 16, 2018 at 11:13

1 Answer 1

4
$\begingroup$

To not leave this unanswered:

ToBoundaryMesh[
  "Coordinates" -> 
   Map[{#[[1]], #[[2]], RandomReal[]} &, {{0, 
      0}, {1, -.5}, {0.7, .8}, {0, 1}}], 
  "BoundaryElements" -> {TriangleElement[{{1, 2, 3}, {1, 3, 4}}]}][
 "Wireframe"[Boxed -> True]]

enter image description here

$\endgroup$
1
  • $\begingroup$ @ user21 Thank you! $\endgroup$ Apr 19, 2019 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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