[go: up one dir, main page]

File: r_to_pix.c

package info (click to toggle)
circlepack 5.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 2,828 kB
  • ctags: 1,683
  • sloc: ansic: 43,152; makefile: 46
file content (15 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "cp_types.h"
#include "cp_proto.h"

/* real pt in box converted to double normpt relative to pix_box. */

int r_to_pix(complex pt, complex *normpt, Pix_box pix_box, Box box) 
{
  normpt->re=pix_box.lx+
    (pix_box.rx-pix_box.lx)*((pt.re-box.lx)/(box.rx-box.lx));
  normpt->im=pix_box.ry-
    (pix_box.ry-pix_box.ly)*((pt.im-box.ly)/(box.ry-box.ly));
  /* note: have flipped the y-coords because canvases treat + as down */
  return 1;
} /* r_to_pix */