/*! Adds a point object to pattern (\a p) at the absolute position (\a x,\a y). Positive y is up. Units are in millimeters. */ void embPattern_addPointObjectAbs(EmbPattern* p, double x, double y) { EmbPointObject pointObj = embPointObject_make(x, y); if(!p) { embLog_error("emb-pattern.c embPattern_addPointObjectAbs(), p argument is null\n"); return; } if(embPointObjectList_empty(p->pointObjList)) { p->pointObjList = p->lastPointObj = embPointObjectList_create(pointObj); } else { p->lastPointObj = embPointObjectList_add(p->lastPointObj, pointObj); } }
/* Adds a point at the absolute position (x,y). Positive y is up. Units are in millimeters. */ void embPattern_addPointObjectAbs(EmbPattern* p, double x, double y) { EmbPointObject pointObj = embPointObject_make(x, y); if(!p) { embLog_error("emb-pattern.c embPattern_addPointObjectAbs(), p argument is null\n"); return; } if(!(p->pointObjList)) { p->pointObjList = (EmbPointObjectList*)malloc(sizeof(EmbPointObjectList)); if(!p->pointObjList) { embLog_error("emb-pattern.c embPattern_addPointObjectAbs(), cannot allocate memory for p->pointObjList\n"); return; } p->pointObjList->pointObj = pointObj; p->pointObjList->next = 0; p->lastPointObj = p->pointObjList; } else { embPointObjectList_add(p->lastPointObj, pointObj); p->lastPointObj = p->lastPointObj->next; } }
/* Adds a point at the absolute position (x,y). Positive y is up. Units are in millimeters. */ void embPattern_addPointObjectAbs(EmbPattern* pattern, double x, double y) { /* TODO: pointer safety */ EmbPointObject pointObj = embPointObject_make(x, y); if(!(pattern->pointObjList)) { pattern->pointObjList = (EmbPointObjectList*)malloc(sizeof(EmbPointObjectList)); /* TODO: malloc fail error */ pattern->pointObjList->pointObj = pointObj; pattern->pointObjList->next = 0; pattern->lastPointObj = pattern->pointObjList; } else { embPointObjectList_add(pattern->lastPointObj, pointObj); pattern->lastPointObj = pattern->lastPointObj->next; } }