omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    implement antialiasing in SceneView

    Pythonista
    sceneview antialiasing
    3
    4
    2796
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • anchovies
      anchovies last edited by anchovies

      I’m trying to draw a simple graph but the output has no antialiasing so it looks ugly. If I drew a full scene

      ‘’’Scene.run(antialiasing = true) ‘’’

      is a valid option. However, I’m making a custom graph class which inherits from Scene. When this is done, it isn’t necessary to pass a run() call. Is it possible to change the class to make it pass this parameter?

      How do I set up antialiasing?

      Here’s the a minimal working example that has a graph.

      https://gist.github.com/67977e87bb013f924ed302dce8660872

      Phuket2 1 Reply Last reply Reply Quote 0
      • Phuket2
        Phuket2 @anchovies last edited by

        @anchovies , I know nothing about your post. But antialiasing = true does not look correct. Try antialiasing = True instead, capital 'T' for True

        1 Reply Last reply Reply Quote 1
        • JonB
          JonB last edited by JonB

          anti_alias is an attribute of SceneView.

          For your example, you might also increase linewidth slightly.
          You might also want to try using ShapeNode, with a ui.Path.

          #in setup:
                 self.p=ShapeNode(p,parent=self)
          
          		
          def plot(self,x,y):
          		p=ui.Path()
          		p.move_to(x[0],y[0])
          		for i in range(len(x) - 1):
          			p.line_to(x[i+1],y[i+1])
          		p.line_join_style=ui.LINE_JOIN_BEVEL
          		self.p.path=p
          		self.p.line_width=1.
          

          This lets you set the line_join_mode (try setting your line width to like 30, and you will see the problem with your original method)

          The one drawback is that this is somewhat slower.
          But, you can probably plot much fewer points, or add curves instead of lines...

          1 Reply Last reply Reply Quote 1
          • anchovies
            anchovies last edited by

            Thanks JonB!

            I completely missed that anti_alias attribute! That totally solved my problem!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors