Lines in P3D only in rectangular mode

edited May 2016 in Android Mode

Hi,

In the app that I am writing, I draw numerous curves, each composed of numerous lines. When the number of lines reahes a certain level, the sketch starts lagging terribly. Hence, I decided to swith the renderer and started using P3D. Problem solved - no lags at all. However, new problem:

Lines in P3D only appear in rectangular mode. This means that, at places where the curve turns a lot, which is the case almost evrywhere, you can see holes between the lines, revealing that the curve is actually a set of lines, not a curve on its own, and making the sketch look considerably ugly.

I have trid using beginShape(), vertex() and endShape(), whith no success. The strokeJoin() and strokeCap(), according to the documentation and, as evidenced from this example, do not work with P3D.

Can you think of a way to get around this problem? It seems pretty easy in nature but I cannot solve it and it destroys my entire sketch.

Thanks in advance!

Answers

  • Can you post a snippet of code that demonstrated this problem? One that we can copy, paste, and run? That way we don't have to reproduce you issue before starting to help you.

  • What was the renderer you switched from?

  • Hey, the code is the following (this is my line class' display method):

         public void display(){
    
            prc.strokeWeight(this.dim);
            prc.stroke(this.redd,this.greenn,this.bluee, this.opacity);
    
            for (int i = 0; i<linelists.size(); i++){
                 prc.line(linelists.get(i)[2],linelists.get(i)[4],linelists.get(i)[3],linelists.get(i)[5]);
            }
          }
    

    Linelists are arrays that hold the points that define the line's beginning and end as well as additional information about that line.

    Before using P3D, I just used the original renderer.

    Also, I tried to add circles at the beginning and end of each line segment with radius equal to the width of the line, so that the line appears rounded. It looks OK, but this produces a few thousand circles that need to be drawn at each frame, producing, again, considerable lags.

    It just seems weird to me that there is no option to round the ends of the lines in 3D, whereas this can be done in 2D.

    Any ideas how to solve that? Thanks!

  • Anyone see a solution to that problem? I have been thinking about it and the one potential solution I have reached is to modify the starting pointsof the lines added so that that the subsequent lines (which are rectangles) do not go out of the previous lines' boundaries. There are 10 scenarios (depending on whether the subsequent line goes to the left, right, vetically upwards or vertically downwards and what is the two lines' relation in terms of their slopes), of which six have two further scenarios and four have three further scenarios, giving 43 + 62 = 24 different scenarios in total. One such example is giving here:

    http://math.stackexchange.com/questions/1100148/geometry-question-translating-a-rectangle-according-to-a-specific-rule

    However, nobody has answered this question yet.

    Plus, I suspect there is going to be a fair amount of calculations involved when adding each line to modify its starting point. Therefore, I do not know if this is the best solution.

    Any ideas?

Sign In or Register to comment.