Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 14728) +++ trunk/src/obj_common.h (revision 14729) @@ -29,6 +29,7 @@ #ifndef PCB_OBJ_COMMON_H #define PCB_OBJ_COMMON_H +#include #include #include #include @@ -190,6 +191,15 @@ return murmurhash(&(c), sizeof(pcb_coord_t)); } +PCB_INLINE unsigned pcb_hash_angle(const pcb_host_trans_t *tr, pcb_angle_t ang) +{ + long l; + ang -= tr->rot; + ang *= 10000; + l = floor(ang); + return murmurhash(&l, sizeof(l)); +} + /* Return the geometric center of an object, as shown (center of bbox usually, but not for an arc) */ void pcb_obj_center(const pcb_any_obj_t *obj, pcb_coord_t *x, pcb_coord_t *y); Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 14728) +++ trunk/src/obj_pstk.c (revision 14729) @@ -174,7 +174,19 @@ pcb_pstk_bbox_(dst, ps, pcb_true); } +/* hash */ +unsigned int pcb_pstk_hash(const pcb_host_trans_t *tr, const pcb_pstk_t *p) +{ + unsigned int crd = 0; + if (!PCB_FLAG_TEST(PCB_FLAG_FLOATER, p)) + crd = pcb_hash_cx(tr, p->x) ^ pcb_hash_cy(tr, p->y); + return pcb_hash_angle(tr, p->rot) ^ pcb_hash_coord(p->Clearance) ^ + pcb_hash_str(p->term) ^ crd ^ + murmurhash(&p->smirror, sizeof(p->smirror)) ^ + murmurhash(&p->xmirror, sizeof(p->xmirror)); +} + /*** utils ***/ pcb_pstk_t *pcb_pstk_copy_meta(pcb_pstk_t *dst, pcb_pstk_t *src) Index: trunk/src/obj_pstk.h =================================================================== --- trunk/src/obj_pstk.h (revision 14728) +++ trunk/src/obj_pstk.h (revision 14729) @@ -86,6 +86,10 @@ void pcb_pstk_bbox(pcb_pstk_t *ps); void pcb_pstk_copper_bbox(pcb_box_t *dst, pcb_pstk_t *ps); +/* hash */ +unsigned int pcb_pstk_hash(const pcb_host_trans_t *tr, const pcb_pstk_t *p); + + void pcb_pstk_set_thermal(pcb_pstk_t *ps, unsigned long lid, unsigned char shape); unsigned char *pcb_pstk_get_thermal(pcb_pstk_t *ps, unsigned long lid, pcb_bool_t alloc);