Guest User

Untitled

a guest
Jan 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. gr = Import["c:\DolphinSharkBox.obj" ];
  2. Graphics3D[gr[[1]]]
  3.  
  4. grc = Import["... \DophinSharkBox.obj", "GraphicsComplex"];
  5. Graphics3D[grc]
  6.  
  7. polygonsc = Join @@ (Normal[grc] /.
  8. HoldPattern[VertexNormals -> _] :> Sequence[]);
  9. polygonsc = polygonsc /. Polygon -> Sequence;
  10. edgesc = DeleteDuplicates[UndirectedEdge @@@ Map[ToString,
  11. Select[Subsets[polygonsc, {2}], Intersection @@ # =!= {} &], {-2}]];
  12.  
  13. cc = Map[ToExpression, ConnectedComponents[Graph[edgesc]], {-1}];
  14. Through@{Length@# &, Tally[Length /@ #] &}@ cc
  15. (* {41, {{3804, 1}, {952, 1}, {288, 2}, {38, 24}, {28, 12}, {6, 1}}} *)
  16.  
  17. Graph[edgesc, VertexStyle -> White, VertexSize -> .005, VertexShapeFunction -> "Point",
  18. EdgeStyle -> Directive[Opacity[.5], Thin, Hue[.35, .5, .8]],
  19. Background -> Black, EdgeShapeFunction -> (Line[#1] &), ImageSize -> 600]
  20.  
  21. Graphics3D[({EdgeForm[], Hue[RandomReal[]], Polygon@#} & /@ cc), Lighting ->"Neutral"]
  22.  
  23. Graphics3D[({EdgeForm[], Hue[RandomReal[]], Polygon@# }&/@cc[[;;2]]), Lighting -> "Neutral"]
  24.  
  25. Graphics3D[({EdgeForm[],Hue[RandomReal[]],Polygon@#}&/@ cc[[3;;-2]]), Lighting -> "Neutral"]
Add Comment
Please, Sign In to add comment