3
$\begingroup$

I want to make a Polygon with straight border lines. For that purpose I wrote the following code, but it doesn't show straight borders.

Graphics3D[{Style[Polygon[{{20, 0, 10}, {50, 0, 10}, {50, 0, 25}, {20, 0, 25}}],
  Lighting -> {{"Ambient", LightBlue}}]}, Boxed -> False, RotationAction -> "Clip"]

How can I make a polygon with straight lines?

enter image description here

$\endgroup$
2
  • $\begingroup$ Related: mathematica.stackexchange.com/q/198/131 $\endgroup$
    – Yves Klett
    Commented Feb 26, 2013 at 10:23
  • $\begingroup$ You can switch the antialiasing quality of Preferences->Appearance->Graphics to Highest but beware as it might make graphics display unresponsive for higher resolution graphics. $\endgroup$
    – gpap
    Commented Feb 26, 2013 at 10:23

2 Answers 2

7
$\begingroup$

The Antialiasing quality dialog in Preferences offers an adjustable setting (if you have appropriate hadware, see here):

anti aliasing dialog

You can compare the differences between the two extremes in the following screen shots:

Graphics3D[
 Polygon[{{20, 0, 10}, {50, 0, 10}, {50, 0, 25}, {20, 0, 25}}], 
 Lighting -> {{"Ambient", LightBlue}},
 Boxed -> False,
 RotationAction -> "Clip"]

No Antialiasing:

enter image description here

Highest quality: enter image description here

They're not as different as you might expect. The results are probably very hardware and operating-system specific.

$\endgroup$
4
$\begingroup$

From a related Q/A Antialiasing of horizontal lines:

 Row[Graphics3D[{Antialiasing -> #,
 Polygon[{{20, 0, 10}, {50, 0, 10}, {50, 0, 25}, {20, 0, 25}}]},
 Lighting -> {{"Ambient", LightBlue}}, Boxed -> False,
 RotationAction -> "Clip", ImageSize -> 400] & /@ {True, False}]

enter image description here

$\endgroup$
4
  • $\begingroup$ thanks for answering,still side boarders are not straight lines $\endgroup$
    – subbu
    Commented Feb 26, 2013 at 11:10
  • $\begingroup$ @subbu Why do you say they're not straight? $\endgroup$
    – cormullion
    Commented Feb 26, 2013 at 11:59
  • $\begingroup$ @cormullion not straight line in the seance,that boarder lines are not smooth. $\endgroup$
    – subbu
    Commented Feb 26, 2013 at 12:08
  • 2
    $\begingroup$ @subbu Does this demo explain why they're not smooth? $\endgroup$
    – cormullion
    Commented Feb 26, 2013 at 12:24

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.