Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lX = RandomVariate[UniformDistribution[{-0.4, 0.4}], {1000}];
- lY = RandomVariate[UniformDistribution[{-0.2, 0.2}], {1000}];
- lZ = RandomVariate[UniformDistribution[{-0.2, 0.2}], {1000}];
- lPoints = Thread[{lX,lY,lZ}];
- g = Graphics3D[{Opacity[.09], EdgeForm[Opacity[.1]], Polygon[#,
- VertexColors -> Table[Hue[RandomReal[]], {Length[#]}]] & /@
- Cases[Normal[ExampleData[{"Geometry3D", "Cow"}]],
- Polygon[x_, ___] :> x, {0, Infinity}]}, Lighting -> "Neutral",
- ImageSize -> 400, Axes -> True];
- Show[g, ListPointPlot3D[lPoints]]
- side[{P_, Q_, R_, ___}, X_] := Det@Differences[{X, P, Q, R}];
- insideQ[polyhedron_, point_] := And @@ Positive[side[#, point] & /@ polyhedron];
- pg = Graphics3D[Point[lPoints,
- VertexColors -> (insideQ[polygonCoords, #] & /@
- lPoints /. {True -> Red,
- False -> Directive[Opacity[0.5], Blue]})], Axes -> True];
- reg = BoundaryDiscretizeGraphics[g]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement