2
$\begingroup$

Consider the following Wolfram Mathematica code

Clear["Global`*"];



nn          = 3;
eps         = Table[Subscript[ep,i],{i,nn}];
xs          = Table[Subscript[x,i],{i,nn}];
alp         = 1/2;
bet         = 2;
Subscript[ep,2] = -alp Subscript[ep,1]/bet;
Subscript[ep,1] = 1;
Subscript[ep,3] = 0;

eqNcar      = -(1 + alp + bet)^(-1) - ((1 + alp + bet)^(-1) - Subscript[x, 1])^2 - ((1 + alp + bet)^(-1) - Subscript[x, 2])^2 + Subscript[x, 3];
eqNpar      = {w,s,w^2+s^2} + 1/(1+ alp+bet) {1,1,1};

eq1         = (-((1 + (1 + alp + bet)*s^2 + (1 + alp + bet)*w^2)*\
    (bet*s + s^2 + w*(alp + w))) + 2*s*(1 + (1 + alp + bet)*s)*\
   (s + alp*s^2 + w*(bet + alp*w)) + 2*w*(1 + (1 + alp + bet)*w)*\
   (alp*s + w + bet*(s^2 + w^2)))/(1 + alp + bet); 

eq2         = (alp*(-s + w)*((1 + alp + bet)^(-1) + s^2 + w^2) -
  (2*w*((1 + alp + bet)^(-1) + w)*(-(alp^2*((1 + alp + bet)^(-1) + s)) +
     bet*((1 + alp + bet)^(-1) + w)))/bet -
  (2*s*((1 + alp + bet)^(-1) + s)*(-(alp*((1 + alp + bet)^(-1) + s)) +
     bet^2*((1 + alp + bet)^(-1) + w)))/bet)*Subscript[ep, 1];

pN = ParametricPlot3D[eqNpar,{w,-1,1},{s,-1,1},\
  MeshFunctions -> {Function[{x,y,z,w,s},(eqNcar/. Thread[xs->eqNpar])-eq1],Function[{x,y,z,w,s},(eqNcar/. Thread[xs->eqNpar])-eq2]},\
  MeshStyle -> {{Blue},{Red}},\
  Mesh -> {{0}},PlotStyle->Orange,PlotPoints->200,
  BoundaryStyle->{1->None},\
  AxesLabel->xs
 ];

cm              = 72/2.54;
image       = Rasterize[Show[pN,ImageSize->10 cm],"Image",ImageResolution->800];
Export["ex.pdf", Show[image, ImageSize -> 10 cm]]

The cartesian of the surface $N$ is eqNcar. I draw the intersections $N\cap E_1$ in blue and $N\cap E_2$ in red where the cartesian equations of $E_1$, $E_2$ are eq1 and eq2 respectively.

I would like to add a pattern on a specific region of $N$. Namely, is is possible to color or to cross out or to draw white waves in the region : $N\cap \{eq2<0\} \cap \{eq1>0\}$ ?

I tried using RegionPlot3D but I did not get acceptable results. I also tried by defining a region with Region but it takes a really long time to process the image (with DiscretizeRegion) and the render was not good.

Is there a way to do this ?

$\endgroup$
2
  • 1
    $\begingroup$ RegionFunction -> Function[{x, y, z, w, s}, eq2 < 0 && eq1 > 0]? $\endgroup$
    – cvgmt
    Jul 8, 2023 at 13:58
  • 1
    $\begingroup$ Or MeshShading -> {{Automatic, Automatic}, {HalftoneShading[], Automatic}} $\endgroup$
    – cvgmt
    Jul 8, 2023 at 14:03

1 Answer 1

4
$\begingroup$

Add

MeshShading -> {{Automatic, Automatic}, {HalftoneShading[],     Automatic}}

etc.

enter image description here

$\endgroup$

Your Answer

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

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