Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dxDrawLine3D, make possible nice connection between each line #871

Open
CrosRoad95 opened this issue Apr 16, 2019 · 7 comments
Open

dxDrawLine3D, make possible nice connection between each line #871

CrosRoad95 opened this issue Apr 16, 2019 · 7 comments
Labels
enhancement New feature or request
Projects

Comments

@CrosRoad95
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When you want to make 2 3d lines, nicely connected together, you just can't do this
image
image

addEventHandler("onClientRender", root, function()
    dxDrawLine3D(-2442.79,731.83,35.02, -2432.79,731.83,35.02, tocolor(255,0,0), 20)
    dxDrawLine3D(-2442.79,731.83,35.02, -2442.79,721.83,35.02, tocolor(255,0,0), 20)
end)

Describe the solution you'd like
my solution is:
skip first start x,y,z in second dxDrawLine3D, and new line will start from last end x,y,z and gap will filed with another line 3d
image
blue rectangle is new one which would be created

Describe alternatives you've considered
/

Additional context
This is only cosmetic issue

@CrosRoad95 CrosRoad95 added the enhancement New feature or request label Apr 16, 2019
@Woovie
Copy link
Contributor

Woovie commented Apr 16, 2019

I feel like this should be left to the persons executing the draw, you know the width and end position of each line. It's not too hard to calculate from there either a square that goes over the corner, or adjust the end points so that they extend to the edge of each other.

@WADmitry
Copy link

As an option it may be a filled circle (it's simpler to calculate, because you have not needed to find the corners, etc)

@qaisjp
Copy link
Contributor

qaisjp commented Apr 16, 2019

Is a dxDrawCircle at the intersection point with radius=lineWidth suitable?

Also, love2d has love.graphics.setLineJoin / LineJoin which is nice.

image

This is their implementation.

@WADmitry
Copy link

Is a dxDrawCircle at the intersection point with radius=lineWidth suitable?

half of the lineWidth I guess

@qaisjp
Copy link
Contributor

qaisjp commented Apr 16, 2019

I feel like this should be left to the persons executing the draw, you know the width and end position of each line. It's not too hard to calculate from there either a square that goes over the corner, or adjust the end points so that they extend to the edge of each other.

I agree, although we could probably publish this calculation as a "useful script" somewhere (as this offset changes depending on the angle between the two lines).

(Actually I don't think an offset is all you need — the miter and bevel options above are not possible with just offsets)

Is a dxDrawCircle at the intersection point with radius=lineWidth suitable?

half of the lineWidth I guess

Also, probably only suitable if you want a rounded edge.

@Woovie
Copy link
Contributor

Woovie commented Apr 17, 2019

I like the idea of it being a useful script, and yeah the love2d options look very nice.

@qaisjp
Copy link
Contributor

qaisjp commented Mar 15, 2020

I propose adding additional arguments to the end of dxDrawLine3D. One argument which is a string for the LineJoin mode, and then support an infinite number of subsequent points.

Old

bool dxDrawLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ [, int color = 0xFFFFFFFF, float width = 1.0, bool postGUI = false ] )

New

bool dxDrawLine3D ( float x1, float y1, float z1, float x2, float y2, float z2 [, int color = 0xFFFFFFFF, float width = 1.0, bool postGUI = false, string lineJoin = "miter", float x3, float y3, float z3, ... ] )

And do the same for dxDrawLine I guess, but probably as a separate PR/issue.

@qaisjp qaisjp added this to Incoming in Proposals via automation Mar 15, 2020
@qaisjp qaisjp moved this from Incoming to Active in Proposals Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Proposals
  
Active
Development

No branches or pull requests

4 participants