Jump to content

How to fill area between two lines?


Ravindu89
 Share

Recommended Posts

I have to make a chart that fills the area between two lines looks like in below. 

image.thumb.png.04327536bdd32a53b63c7c4cbc3db644.png

I have calculated and drawn two lines and connected each lines (See below image)

image.thumb.png.f030dc14352e49334b7ae03487970589.png

And I have used 2 approaches to complete this task.

  1. drawPolygon
  2. Using color for beginFill

and both time I have failed. (See in below)

image.thumb.png.9dbd8b74e8033ebae79b9d323c22a18e.png

Please advice me. 

Link to comment
Share on other sites

The result will differ for 2d and webgl. Pixi WebGL Graphics uses "earcut" library to triangulate it, while 2d Graphics uses HTMLCanvasRendering2D Context, and whatever triangulation is inside. You have to change earcut to something else, or do triangulation manually, which is easier condiering your input. You can even use Mesh instead of Graphics.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...