void output_INSERT(Dwg_Object* obj) { Dwg_Entity_INSERT* insert; insert = obj->tio.entity->tio.INSERT; //if (insert->block_header->handleref.code == 5) if(42) //XXX did this to test the new handleref.code handling "code" { printf( "\t<use id=\"dwg-object-%d\" transform=\"translate(%f %f) rotate(%f) scale(%f %f)\" xlink:href=\"#symbol-%lu\" /><!-- block_header->handleref: %d.%d.%lu -->\n", obj->index, transform_X(insert->ins_pt.x), transform_Y(insert->ins_pt.y), (180.0 / M_PI) * insert->rotation_ang, insert->scale.x, insert->scale.y, insert->block_header->absolute_ref, insert->block_header->handleref.code, insert->block_header->handleref.size, insert->block_header->handleref.value); } else { printf( "\n\n<!-- WRONG INSERT(%d.%d.%lu): handleref = %d.%d.%lu -->\n", obj->handle.code, obj->handle.size, obj->handle.value, insert->block_header->handleref.code, insert->block_header->handleref.size, insert->block_header->handleref.value); } }
void output_ARC(Dwg_Object* obj) { Dwg_Entity_ARC* arc; arc = obj->tio.entity->tio.ARC; double x_start = arc->center.x + arc->radius * cos(arc->start_angle); double y_start = arc->center.y + arc->radius * sin(arc->start_angle); double x_end = arc->center.x + arc->radius * cos(arc->end_angle); double y_end = arc->center.y + arc->radius * sin(arc->end_angle); //Assuming clockwise arcs. int large_arc = (arc->end_angle - arc->start_angle < 3.1415) ? 0 : 1; printf( "\t<path id=\"dwg-object-%d\" d=\"M %f,%f A %f,%f 0 %d 0 %f,%f\" fill=\"none\" stroke=\"blue\" stroke-width=\"%f\" />\n", obj->index, transform_X(x_start), transform_Y(y_start), arc->radius, arc->radius, large_arc, transform_X(x_end), transform_Y(y_end), 0.1); }
void output_CIRCLE(Dwg_Object* obj) { Dwg_Entity_CIRCLE* circle; circle = obj->tio.entity->tio.CIRCLE; printf( "\t<circle id=\"dwg-object-%d\" cx=\"%f\" cy=\"%f\" r=\"%f\" fill=\"none\" stroke=\"blue\" stroke-width=\"0.1px\" />\n", obj->index, transform_X(circle->center.x), transform_Y(circle->center.y), circle->radius); }
void output_LINE(Dwg_Object* obj) { Dwg_Entity_LINE* line; line = obj->tio.entity->tio.LINE; printf( "\t<path id=\"dwg-object-%d\" d=\"M %f,%f %f,%f\" style=\"fill:none;stroke:blue;stroke-width:0.1px\" />\n", obj->index, transform_X(line->start.x), transform_Y(line->start.y), transform_X(line->end.x), transform_Y(line->end.y)); }
int mfield_sht_calc(const gsl_vector *g, const double r, const gsl_vector *theta, const gsl_vector *phi, gsl_vector *Y, gsl_vector *Z, mfield_sht_workspace *w) { const size_t M = w->M; if (theta->size != M) { GSL_ERROR("theta vector has wrong length", GSL_EBADLEN); } else if (phi->size != M) { GSL_ERROR("phi vector has wrong length", GSL_EBADLEN); } else if (Y->size != M) { GSL_ERROR("Y vector has wrong length", GSL_EBADLEN); } else if (Z->size != M) { GSL_ERROR("Z vector has wrong length", GSL_EBADLEN); } else { int s = GSL_SUCCESS; size_t i; /* scale phi to [-1/2,1/2] and theta to [0,1/2] for input to nfsft */ for (i = 0; i < M; ++i) { double ti = gsl_vector_get(theta, i) / (2.0 * M_PI); double pi = gsl_vector_get(phi, i) / (2.0 * M_PI); if (pi >= 0.5) pi -= 1.0; w->plan.x[2*i] = pi; w->plan.x[2*i + 1] = ti; } /* node-dependent precomputation */ nfsft_precompute_x(&(w->plan)); /* perform vector transforms */ transform_Y(g, r, theta, Y, w); transform_Z(g, r, Z, w); return s; } }
void output_TEXT(Dwg_Object* obj) { Dwg_Entity_TEXT* text; text = obj->tio.entity->tio.TEXT; /*TODO: Juca, fix it properly: */ if (text->text_value[0] == '&') return; printf( "\t<text id=\"dwg-object-%d\" x=\"%f\" y=\"%f\" font-family=\"Verdana\" font-size=\"%f\" fill=\"blue\">%s</text>\n", obj->index, transform_X(text->insertion_pt.x), transform_Y(text->insertion_pt.y), text->height /* fontsize */, text->text_value); }