Skip to content

fixed #2923: [DOC] distance syntax is wrong#2924

Merged
josdejong merged 2 commits into
josdejong:developfrom
tmtron:develop
Mar 29, 2023
Merged

fixed #2923: [DOC] distance syntax is wrong#2924
josdejong merged 2 commits into
josdejong:developfrom
tmtron:develop

Conversation

@tmtron
Copy link
Copy Markdown
Contributor

@tmtron tmtron commented Mar 27, 2023

this fixes #2923

@josdejong
Copy link
Copy Markdown
Owner

Thanks @tmtron

The syntax descriptions are indeed mixed with examples. I think thought that replacing all of it with math.distance(pointOne, pointTwo, [pointThree]) misses a lot of the actually supported syntax, i.e. a point can be either an array [x, y] or an object like {pointX, pointY}.

Wouldn't it be better to keep all of the syntaxes but remove the values? I.e. replace:

math.distance({pointOneX: 4, pointOneY: 5}, {pointTwoX: 2, pointTwoY: 7})

with:

math.distance({ pointOneX, pointOneY }, { pointTwoX, pointTwoY })

On a side note: the function distance as a very broad API, it may be good to have a look on whether we can simplify and unify this some way.

@tmtron
Copy link
Copy Markdown
Contributor Author

tmtron commented Mar 29, 2023

Wouldn't it be better to keep all of the syntaxes but remove the values?

That's of course also possible. I was just under the wrong impression that the syntax should only be one line. But there are already other functions that use multiple lines.

I am not quite sure, how the individual array elements should be named, maybe like this?

   math.distance([x1,y1], [x2,y2])
   math.distance({pointOneX, pointOneY}, {pointTwoX, pointTwoY})
   math.distance([x1,y1,z1], [x2,y2,z2])
   math.distance({pointOneX, pointOneY, pointOneZ}, {pointTwoX, pointTwoY, pointTwoZ})
   math.distance([x1,y1,z1,a1], [x2,y2,z2,a2])
   math.distance([[x1,y1], [x2,y2], [x3,y3]])
   math.distance([[x1,y1,z1], [x2,y2,z2], [x3,y3,z3]])
   math.distance([x1,y1], [x2,y2,z2])
   math.distance([x1,y1], [x2,y2], [x3,y3])
   math.distance({pointX, pointY}, {lineOnePtX, lineOnePtY}, {lineTwoPtX, lineTwoPtY})
   math.distance([x1,y1,z1], [x0, y0, z0, a, b, c])
   math.distance({pointX, pointY, pointZ}, {x0, y0, z0, a, b, c})

@josdejong
Copy link
Copy Markdown
Owner

Yes, that's it indeed. Each line is actually supported syntax 😅

* added detailed syntax descriptions
@josdejong
Copy link
Copy Markdown
Owner

Thanks!

@josdejong josdejong merged commit c97e0be into josdejong:develop Mar 29, 2023
@josdejong
Copy link
Copy Markdown
Owner

Published now in v11.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] distance syntax is wrong

2 participants