• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ point_add函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中point_add函数的典型用法代码示例。如果您正苦于以下问题:C++ point_add函数的具体用法?C++ point_add怎么用?C++ point_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了point_add函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: aadlsubprogram_project_point_on_nearest_border

void
aadlsubprogram_project_point_on_nearest_border(Aadlbox *aadlbox,Point *p,
					       real *angle)
{
  Point center;
  real w, h, r, t, norm_factor;

  w = aadlbox->element.width;
  h = aadlbox->element.height;
  center.x = aadlbox->element.corner.x + 0.5 * w;
  center.y = aadlbox->element.corner.y + 0.5 * h;

  point_sub(p, &center);

  /* normalize ellipse to a circle */
  r = w;
  norm_factor = r/h;
  p->y *= norm_factor;

  t = point_to_angle(p);

  p->x = 0.5*r*cos(t);
  p->y = 0.5*r*sin(t);

  /* unnormalize */
  p->y /= norm_factor;

  point_add(p, &center);
  *angle = t;
}
开发者ID:brunetton,项目名称:dia,代码行数:30,代码来源:aadlsubprogram.c


示例2: constraint_move_handle

static void
constraint_move_handle(Constraint *constraint, Handle *handle,
		 Point *to, HandleMoveReason reason, ModifierKeys modifiers)
{
  Point p1, p2;
  Point *endpoints;
  
  assert(constraint!=NULL);
  assert(handle!=NULL);
  assert(to!=NULL);

  if (handle->id == HANDLE_MOVE_TEXT) {
    constraint->text_pos = *to;
  } else  {
    endpoints = &constraint->connection.endpoints[0]; 
    p1.x = 0.5*(endpoints[0].x + endpoints[1].x);
    p1.y = 0.5*(endpoints[0].y + endpoints[1].y);
    connection_move_handle(&constraint->connection, handle->id, to, reason);
    p2.x = 0.5*(endpoints[0].x + endpoints[1].x);
    p2.y = 0.5*(endpoints[0].y + endpoints[1].y);
    point_sub(&p2, &p1);
    point_add(&constraint->text_pos, &p2);
  }

  constraint_update_data(constraint);
}
开发者ID:TVilaboa,项目名称:Proyecto-Parser-C,代码行数:26,代码来源:constraint.c


示例3: bezierline_move_handle

static ObjectChange*
bezierline_move_handle(Bezierline *bezierline, Handle *handle,
		       Point *to, ConnectionPoint *cp,
		       HandleMoveReason reason, ModifierKeys modifiers)
{
  assert(bezierline!=NULL);
  assert(handle!=NULL);
  assert(to!=NULL);

  if (reason == HANDLE_MOVE_CREATE || reason == HANDLE_MOVE_CREATE_FINAL) {
    /* During creation, change the control points */
    BezierConn *bez = &bezierline->bez;
    Point dist = bez->bezier.points[0].p1;

    point_sub(&dist, to);
    dist.y = 0;
    point_scale(&dist, 0.332);

    bezierconn_move_handle(bez, handle, to, cp, reason, modifiers);

    bez->bezier.points[1].p1 = bez->bezier.points[0].p1;
    point_sub(&bez->bezier.points[1].p1, &dist);
    bez->bezier.points[1].p2 = *to;
    point_add(&bez->bezier.points[1].p2, &dist);
  } else {
    bezierconn_move_handle(&bezierline->bez, handle, to, cp, reason, modifiers);
  }

  bezierline_update_data(bezierline);

  return NULL;
}
开发者ID:GNOME,项目名称:dia,代码行数:32,代码来源:bezier.c


示例4: link_move_handle

static ObjectChange*
link_move_handle(Link *link, Handle *handle,
		 Point *to, ConnectionPoint *cp, 
		 HandleMoveReason reason, ModifierKeys modifiers)
{
  Point p1, p2;
  Point *endpoints;

  assert(link!=NULL);
  assert(handle!=NULL);
  assert(to!=NULL);

  if (handle->id == HANDLE_MOVE_MID_POINT) {
    link->pm = *to;
  } else  {
    endpoints = &link->connection.endpoints[0];
    p1.x = 0.5*(endpoints[0].x + endpoints[1].x);
    p1.y = 0.5*(endpoints[0].y + endpoints[1].y);
    connection_move_handle(&link->connection, handle->id, to, cp, reason, modifiers);
    p2.x = 0.5*(endpoints[0].x + endpoints[1].x);
    p2.y = 0.5*(endpoints[0].y + endpoints[1].y);
    point_sub(&p2, &p1);
    point_add(&link->pm, &p2);
  }

  link_update_data(link);
  return NULL;
}
开发者ID:UIKit0,项目名称:dia,代码行数:28,代码来源:link.c


示例5: message_move_handle

static ObjectChange*
message_move_handle(Message *message, Handle *handle,
		    Point *to, ConnectionPoint *cp,
		    HandleMoveReason reason, ModifierKeys modifiers)
{
  Point p1, p2;
  Point *endpoints;
  
  assert(message!=NULL);
  assert(handle!=NULL);
  assert(to!=NULL);

  if (handle->id == HANDLE_MOVE_TEXT) {
    message->text_pos = *to;
  } else  {
    endpoints = &message->connection.endpoints[0]; 
    p1.x = 0.5*(endpoints[0].x + endpoints[1].x);
    p1.y = 0.5*(endpoints[0].y + endpoints[1].y);
    connection_move_handle(&message->connection, handle->id, to, cp, reason, modifiers);
    connection_adjust_for_autogap(&message->connection);
    p2.x = 0.5*(endpoints[0].x + endpoints[1].x);
    p2.y = 0.5*(endpoints[0].y + endpoints[1].y);
    point_sub(&p2, &p1);
    point_add(&message->text_pos, &p2);
  }

  message_update_data(message);

  return NULL;
}
开发者ID:AmiGanguli,项目名称:dia,代码行数:30,代码来源:message.c


示例6: ECDSA_verify

int ECDSA_verify(const char *msg, const struct affine_point *Q,
		 const gcry_mpi_t sig, const struct curve_params *cp)
{
  gcry_mpi_t e, r, s;
  struct affine_point X1, X2;
  int res = 0;
  r = gcry_mpi_new(0);
  s = gcry_mpi_new(0);
  gcry_mpi_div(s, r, sig, cp->dp.order, 0);
  if (gcry_mpi_cmp_ui(s, 0) <= 0 || gcry_mpi_cmp(s, cp->dp.order) >= 0 ||
      gcry_mpi_cmp_ui(r, 0) <= 0 || gcry_mpi_cmp(r, cp->dp.order) >= 0) 
    goto end;
  gcry_mpi_scan(&e, GCRYMPI_FMT_USG, msg, 64, NULL);
  gcry_mpi_mod(e, e, cp->dp.order);
  gcry_mpi_invm(s, s, cp->dp.order);
  gcry_mpi_mulm(e, e, s, cp->dp.order);
  X1 = pointmul(&cp->dp.base, e, &cp->dp);
  gcry_mpi_mulm(e, r, s, cp->dp.order);
  X2 = pointmul(Q, e, &cp->dp);
  point_add(&X1, &X2, &cp->dp);
  gcry_mpi_release(e);
  if (! point_is_zero(&X1)) {
    gcry_mpi_mod(s, X1.x, cp->dp.order);
    res = ! gcry_mpi_cmp(s, r);
  }
  point_release(&X1);
  point_release(&X2);
 end:
  gcry_mpi_release(r);
  gcry_mpi_release(s);
  return res;
}
开发者ID:asciimoo,项目名称:PyECC,代码行数:32,代码来源:protocol.c


示例7: beziershape_move

ObjectChange*
beziershape_move(BezierShape *bezier, Point *to)
{
  Point p;
  int i;
  
  p = *to;
  point_sub(&p, &bezier->points[0].p1);

  bezier->points[0].p1 = bezier->points[0].p3 = *to;
  for (i = 1; i < bezier->numpoints; i++) {
    point_add(&bezier->points[i].p1, &p);
    point_add(&bezier->points[i].p2, &p);
    point_add(&bezier->points[i].p3, &p);
  }

  return NULL;
}
开发者ID:krattai,项目名称:monoflow,代码行数:18,代码来源:beziershape.c


示例8: bezierconn_move

/*!
 * \brief Move the entire object.
 * @param bezier The object being moved.
 * @param to Where the object is being moved to.  This is the first point
 * of the points array.
 * @return NULL
 * \memberof _BezierConn
 */
ObjectChange*
bezierconn_move (BezierConn *bezier, Point *to)
{
  Point p;
  int i;
  
  p = *to;
  point_sub(&p, &bezier->bezier.points[0].p1);

  bezier->bezier.points[0].p1 = *to;
  for (i = 1; i < bezier->bezier.num_points; i++) {
    point_add(&bezier->bezier.points[i].p1, &p);
    point_add(&bezier->bezier.points[i].p2, &p);
    point_add(&bezier->bezier.points[i].p3, &p);
  }

  return NULL;
}
开发者ID:AmiGanguli,项目名称:dia,代码行数:26,代码来源:bezier_conn.c


示例9: polyline_create

/** user_data is a struct polyline_create_data, containing an array of 
    points and a count.
    If user_data is NULL, the startpoint is used and a 1x1 line is created.
    Otherwise, the startpoint is ignored.
*/
static DiaObject *
polyline_create(Point *startpoint,
		  void *user_data,
		  Handle **handle1,
		  Handle **handle2)
{
  Polyline *polyline;
  PolyConn *poly;
  DiaObject *obj;
  Point defaultlen = { 1.0, 1.0 };

  /*polyline_init_defaults();*/
  polyline = g_malloc0(sizeof(Polyline));
  poly = &polyline->poly;
  obj = &poly->object;
  
  obj->type = &polyline_type;
  obj->ops = &polyline_ops;

  if (user_data == NULL) {
    polyconn_init(poly, 2);

    poly->points[0] = *startpoint;
    poly->points[1] = *startpoint;

    point_add(&poly->points[1], &defaultlen);

    *handle1 = poly->object.handles[0];
    *handle2 = poly->object.handles[1];
  } else {
    MultipointCreateData *pcd = (MultipointCreateData *)user_data;

    polyconn_init(poly, pcd->num_points);

    /* Handles are set up by polyconn_init and polyconn_update_data */
    polyconn_set_points(poly, pcd->num_points, pcd->points);

    *handle1 = poly->object.handles[0];
    *handle2 = poly->object.handles[pcd->num_points-1];
  }


  polyline->line_width =  attributes_get_default_linewidth();
  polyline->line_color = attributes_get_foreground();
  attributes_get_default_line_style(&polyline->line_style,
				    &polyline->dashlength);
  polyline->line_join = LINEJOIN_MITER;
  polyline->line_caps = LINECAPS_BUTT;
  polyline->start_arrow = attributes_get_default_start_arrow();
  polyline->end_arrow = attributes_get_default_end_arrow();
  polyline->corner_radius = 0.0;

  polyline_update_data(polyline);

  return &polyline->poly.object;
}
开发者ID:mpuels,项目名称:dia,代码行数:61,代码来源:polyline.c


示例10: stdpath_move

/*!
 * \brief Move the whole object to the given position
 * 
 * If the object position does not change the whole object should not either.
 * This is used as a kludge to call the protected update_data() function
 *
 * \memberof StdPath
 */
static ObjectChange* 
stdpath_move (StdPath *stdpath, Point *to)
{
  DiaObject *obj = &stdpath->object;
  Point delta = *to;
  int i;

  point_sub (&delta, &obj->position);
  
  for (i = 0; i < stdpath->num_points; ++i) {
     BezPoint *bp = &stdpath->points[i];

     point_add (&bp->p1, &delta);
     point_add (&bp->p2, &delta);
     point_add (&bp->p3, &delta);
  }
  stdpath_update_data (stdpath);
  return NULL;
}
开发者ID:UIKit0,项目名称:dia,代码行数:27,代码来源:standard-path.c


示例11: bezierline_create

static Object *
bezierline_create(Point *startpoint,
                  void *user_data,
                  Handle **handle1,
                  Handle **handle2)
{
    Bezierline *bezierline;
    BezierConn *bez;
    Object *obj;
    Point defaultlen = { .3, .3 };

    /*bezierline_init_defaults();*/
    bezierline = g_new(Bezierline, 1);
    bez = &bezierline->bez;
    obj = (Object *) bezierline;

    obj->type = &bezierline_type;
    obj->ops = &bezierline_ops;

    bezierconn_init(bez);

    bez->points[0].p1 = *startpoint;
    bez->points[1].p1 = *startpoint;
    point_add(&bez->points[1].p1, &defaultlen);
    bez->points[1].p2 = bez->points[1].p1;
    point_add(&bez->points[1].p2, &defaultlen);
    bez->points[1].p3 = bez->points[1].p2;
    point_add(&bez->points[1].p3, &defaultlen);

    bezierline_update_data(bezierline);

    bezierline->line_width =  attributes_get_default_linewidth();
    bezierline->line_color = attributes_get_foreground();
    attributes_get_default_line_style(&bezierline->line_style,
                                      &bezierline->dashlength);
    bezierline->start_arrow = attributes_get_default_start_arrow();
    bezierline->end_arrow = attributes_get_default_end_arrow();

    *handle1 = bez->object.handles[0];
    *handle2 = bez->object.handles[3];
    return (Object *)bezierline;
}
开发者ID:TVilaboa,项目名称:Proyecto-Parser-C,代码行数:42,代码来源:bezier.c


示例12: bus_create

static DiaObject *
bus_create(Point *startpoint,
	   void *user_data,
	   Handle **handle1,
	   Handle **handle2)
{
  Bus *bus;
  Connection *conn;
  LineBBExtras *extra;
  DiaObject *obj;
  Point defaultlen = { 5.0, 0.0 };
  int i;

  bus = g_malloc0(sizeof(Bus));

  conn = &bus->connection;
  conn->endpoints[0] = *startpoint;
  conn->endpoints[1] = *startpoint;
  point_add(&conn->endpoints[1], &defaultlen);
 
  obj = &conn->object;
  extra = &conn->extra_spacing;

  obj->type = &bus_type;
  obj->ops = &bus_ops;

  bus->num_handles = DEFAULT_NUMHANDLES;

  connection_init(conn, 2+bus->num_handles, 0);
  bus->line_color = attributes_get_foreground();
  bus->handles = g_malloc(sizeof(Handle *)*bus->num_handles);
  bus->parallel_points = g_malloc(sizeof(Point)*bus->num_handles);
  for (i=0;i<bus->num_handles;i++) {
    bus->handles[i] = g_new0(Handle,1);
    bus->handles[i]->id = HANDLE_BUS;
    bus->handles[i]->type = HANDLE_MINOR_CONTROL;
    bus->handles[i]->connect_type = HANDLE_CONNECTABLE_NOBREAK;
    bus->handles[i]->connected_to = NULL;
    bus->handles[i]->pos = *startpoint;
    bus->handles[i]->pos.x += 5*((real)i+1)/(bus->num_handles+1);
    bus->handles[i]->pos.y += (i%2==0)?1.0:-1.0;
    obj->handles[2+i] = bus->handles[i];
  }

  extra->start_trans = 
    extra->end_trans = 
    extra->start_long =
    extra->end_long = LINE_WIDTH/2.0;  
  bus_update_data(bus);

  *handle1 = obj->handles[0];
  *handle2 = obj->handles[1];
  return &bus->connection.object;
}
开发者ID:krattai,项目名称:monoflow,代码行数:54,代码来源:bus.c


示例13: implements_move

static void
implements_move(Implements *implements, Point *to)
{
  Point start_to_end;
  Point delta;
  Point *endpoints = &implements->connection.endpoints[0]; 

  delta = *to;
  point_sub(&delta, &endpoints[0]);
  
  start_to_end = endpoints[1];
  point_sub(&start_to_end, &endpoints[0]);

  endpoints[1] = endpoints[0] = *to;
  point_add(&endpoints[1], &start_to_end);

  point_add(&implements->text_pos, &delta);
  
  implements_update_data(implements);
}
开发者ID:TVilaboa,项目名称:Proyecto-Parser-C,代码行数:20,代码来源:implements.c


示例14: message_move

static void
message_move(Message *message, Point *to)
{
  Point start_to_end;
  Point *endpoints = &message->connection.endpoints[0]; 
  Point delta;

  delta = *to;
  point_sub(&delta, &endpoints[0]);
 
  start_to_end = endpoints[1];
  point_sub(&start_to_end, &endpoints[0]);

  endpoints[1] = endpoints[0] = *to;
  point_add(&endpoints[1], &start_to_end);

  point_add(&message->text_pos, &delta);
  
  message_update_data(message);
}
开发者ID:TVilaboa,项目名称:Proyecto-Parser-C,代码行数:20,代码来源:message.c


示例15: implements_create

static Object *
implements_create(Point *startpoint,
		  void *user_data,
		  Handle **handle1,
		  Handle **handle2)
{
  Implements *implements;
  Connection *conn;
  Object *obj;
  Point defaultlen = { 1.0, 1.0 };

  if (implements_font == NULL)
    implements_font = font_getfont("Courier");
  
  implements = g_malloc(sizeof(Implements));

  conn = &implements->connection;
  conn->endpoints[0] = *startpoint;
  conn->endpoints[1] = *startpoint;
  point_add(&conn->endpoints[1], &defaultlen);
 
  obj = (Object *) implements;
  
  obj->type = &implements_type;
  obj->ops = &implements_ops;
  
  connection_init(conn, 4, 0);

  implements->text = strdup("");
  implements->text_width = 0.0;
  implements->text_pos = conn->endpoints[1];
  implements->text_pos.x -= 0.3;
  implements->circle_diameter = 0.7;

  implements->text_handle.id = HANDLE_MOVE_TEXT;
  implements->text_handle.type = HANDLE_MINOR_CONTROL;
  implements->text_handle.connect_type = HANDLE_NONCONNECTABLE;
  implements->text_handle.connected_to = NULL;
  obj->handles[2] = &implements->text_handle;
  
  implements->circle_handle.id = HANDLE_CIRCLE_SIZE;
  implements->circle_handle.type = HANDLE_MINOR_CONTROL;
  implements->circle_handle.connect_type = HANDLE_NONCONNECTABLE;
  implements->circle_handle.connected_to = NULL;
  obj->handles[3] = &implements->circle_handle;

  implements->properties_dialog = NULL;
  
  implements_update_data(implements);

  *handle1 = obj->handles[0];
  *handle2 = obj->handles[1];
  return (Object *)implements;
}
开发者ID:TVilaboa,项目名称:Proyecto-Parser-C,代码行数:54,代码来源:implements.c


示例16: constraint_move

static void
constraint_move(Constraint *constraint, Point *to)
{
  Point start_to_end;
  Point *endpoints = &constraint->connection.endpoints[0]; 
  Point delta;

  delta = *to;
  point_sub(&delta, &endpoints[0]);
 
  start_to_end = endpoints[1];
  point_sub(&start_to_end, &endpoints[0]);

  endpoints[1] = endpoints[0] = *to;
  point_add(&endpoints[1], &start_to_end);

  point_add(&constraint->text_pos, &delta);
  
  constraint_update_data(constraint);
}
开发者ID:TVilaboa,项目名称:Proyecto-Parser-C,代码行数:20,代码来源:constraint.c


示例17: compound_move

static ObjectChange *
compound_move (Compound * comp, Point * to)
{
  Point diff;
  Handle * h;
  gint i, num_handles;

  diff.x = to->x - comp->object.position.x;
  diff.y = to->y - comp->object.position.y;

  num_handles = comp->object.num_handles;
  for (i = 0; i < num_handles; i++)
    {
      h = &comp->handles[i];
      point_add (&h->pos, &diff);
    }
  point_add (&comp->mount_point.pos, &diff);

  compound_update_data (comp);
  return NULL;
}
开发者ID:brunetton,项目名称:dia,代码行数:21,代码来源:compound.c


示例18: transition_move

static ObjectChange*
transition_move(Transition* transition, Point* newpos)
{
  Point delta;
  ObjectChange *change;

  
  /* Find a delta in order to move the text handles along with the transition */
  delta = *newpos;
  point_sub(&delta, &transition->orth.points[0]);
  
  change = orthconn_move(&transition->orth, newpos);

  /* Move the text handles */ 
  point_add(&transition->trigger_text_pos, &delta);
  point_add(&transition->guard_text_pos, &delta);
  
  uml_transition_update_data(transition);

  return change;
}
开发者ID:brunetton,项目名称:dia,代码行数:21,代码来源:transition.c


示例19: link_move

static ObjectChange*
link_move(Link *link, Point *to)
{
  Point start_to_end;
  Point *endpoints = &link->connection.endpoints[0];
  Point delta;

  delta = *to;
  point_sub(&delta, &endpoints[0]);

  start_to_end = endpoints[1];
  point_sub(&start_to_end, &endpoints[0]);

  endpoints[1] = endpoints[0] = *to;
  point_add(&endpoints[1], &start_to_end);

  point_add(&link->pm, &delta);

  link_update_data(link);
  return NULL;
}
开发者ID:UIKit0,项目名称:dia,代码行数:21,代码来源:link.c


示例20: center_of_mass

static point center_of_mass(unsigned n, point o[])
{
  point com;
  unsigned i;
  unsigned long tn;
  com = point_zero;
  for (i = 0; i < n; ++i)
    com = point_add(com, o[i]);
  mpi_add_doubles(comm_mpi(), point_arr(&com), 3);
  tn = mpi_add_ulong(comm_mpi(), n);
  return point_scale(com, 1.0 / tn);
}
开发者ID:ibaned,项目名称:tetknife,代码行数:12,代码来源:rib.c



注:本文中的point_add函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ point_sub函数代码示例发布时间:2022-05-30
下一篇:
C++ point3函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap