Add a New Comment (Rich Markup)
I attached a file with proposed name changes. Some cases are not decided yet. Comments welcome. We should also add the mode = 'all'/'pair' to (almost) all two-object operations (intersect,project,distance). (file #30540)
I do not like these shortened names POP, LWP, etc, which give no clue as to what they do. I propose to use full names that clearly specify the purpose. If the user looks in the index under intersection, and sees a function intersectionLineWithPlane, he can get an idea what it does and whether it is interesting to explore that function. But if you see a lot of intersectionXYZ, you probably do not even bother to start reading. Also, the functions can all be named after single case operation, even if they work on multiple objects as well. Next, there should not be any hidden geometry in the naming. E.g., intersectionPointsPOP (intersection points of perpendiculars through points on planes). Then, the result of the operation should not be mentioned, if the result is unique. The educated user knows what the intersection is of the geometrical entities involved. In cases where two functions do the same, but one returns the resulting geometry, the other the parametric values, the first one should not mention the return type, while the latter gets the addition ...Times. Or we could add an option to the above function to return the parametric values instead. Please give preference, if any. Finally, we can shorten the names by not using the noun but the verb form of the operation. Thus e.g. some name changes could be: intersectionPointsPOP -> projectPointOnPlane intersectionPointsLWP -> intersectLineWithPlane intersectionTimesLWP -> intersectLineWithPlaneTimes or intersectLineWithPLane(times=True) ? Any comments? Any additional rules? If ok, we can make a renaming table to see if we can cover everything. Another possible track would be to create Line, Plane, Segment, Vector, ... classes, that could be used to check/reshape the input arrays, and then have simple project/intersect methods. This could also be done as a second step after the renaming of geomtools methods. The Coords(X).project(Y) would call geomtools.projectPointOnPlane if Y is a Plane object, and geomtools.projectPointOnLine if Y is a Line object.
Sorry, this is indeed what happened: I looked into geomtools.py (where similar functions are located) but not in coords.py! I agree to add the full functionality in geomtools and then call it by a corresponding Coords method. I think that geomtools is already nicely structured, apart from the fact that P can mean either point or plane, and this can be confusing such as: intersectionTimesPOP = points on planes intersectionTimesPOL = points on lines intersectionTimesSWP = segments with planes Should a point be represented by a X instead? We could then add a commented list to explain: X point P plane V vector L line S segment T triangle
There is already Coords.distanceFromPlane. I am not sure if it supports multiple planes (distanceFromLines does). So I would not like to add more confusion on what to use when: Coords.distanceFromPlane or geomtools.distancesPFP. The same holds for Coords.projectOnPlane, which is the same as geomtools.intersectionPointsPOP. I think we need to clean this up by - renaming the functions/methods appropriately, - checking which implementation is the best, - adding the full functionality in one place: this can either be a Coords method, or a function in geomtools which is then called by the Coords method. This may be a good occasion to start doing so.
I think that this function is missing in geomtools. Could you please check if it fits there? def distancesPFP(X,p,n,mode='all'): """Return the distances of points X from planes (p,n). Parameters: - `X`: a (nX,3) shaped array of points (`mode=all`) or broadcast compatible array (`mode=pair`). - `p`,`n`: (np,3) shaped arrays of points and normals, defining a single plane or a set of planes. - `mode`: `all` to calculate the distance of each point X from all planes (p,n) or `pair` for pairwise distances. Returns a (nX,np) shaped (`mode=all`) array of distances. """ Y = intersectionPointsPOP(X, p, n, mode) if mode == 'all': X = asarray(X).reshape(-1, 1, 3) return length(Y-X)
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 3 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.11