Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Discussion] Type-consistent through basic math operation

Aperta
#1,345 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

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:
image

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:

  1. Make computation within each type constant.
  2. Provide casting methods like v0 = p0.CastToVector(), or v0 = 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di compas-dev/compas

Tutte le issue di compas-dev/compas

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.