[Discussion] Type-consistent through basic math operation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- computer-graphics
Direzione di ricerca
Inizia esaminando gli esempi di Point e Vector nella documentazione COMPAS collegata e analizza il comportamento pubblico esistente descritto per +, -, e la conversione. Il lavoro è completato quando esistono una policy concordata e documentata sulla coerenza dei tipi e una casting API, con le operazioni interessate coperte da test; l’issue non indica file sorgente né test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Case 1:
In the documentation: https://compas.dev/compas/latest/userguide/basics.geometry.points_and_vectors.html
We have:
The different resulting types of + and - for Point looks quite strange to me at the beginning...
It is understandable after a bit of thinking that - for point should result a "vector" as it means direction from p0 to p1.
However, as a basic geometry library, it is recommended to make types consistent across such basic math operations, rather than "interpret" it subjectively -- this may lead to unexpected errors and increase maintenance cost.
Case 2:
Another scenario may happen is when I have a p0 from some computation, and would like to use the corresponding v0 so that I can use methods in the compas.Vector class.
Currently there is no provided method in compas for doing sth like v0 = Vector(p0) or v0 = p0.CastToVector().
Recommendation
Perhaps such cases are due to a legacy where "type" was not considered as a first-class citizen in Python development...
I would however recommend to unify the types and make the computation more consistent.
For the math operations, following approach could be an option:
- Make computation within each
typeconstant. - Provide casting methods like
v0 = p0.CastToVector(), orv0 = p0.CastToVector().
- Lingua principale
- Python
- Stelle
- 386
- Fork
- 122
- Merge medio
- 11g 46m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di compas-dev/compas
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
compas-dev/compas#1523 · 3 commenti ·
-
Numpy and Rhino 9 Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
compas-dev/compas#1507 · 2 commenti · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
compas-dev/compas#1504 · 1 commento ·
-
compas-dev/compas#1493 · 1 reazione · 1 assegnatario ·
-
compas-dev/compas#1487 · 1 reazione · 1 assegnatario ·
Tutte le issue di compas-dev/compas
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·