Lines Matching defs:star

2  * <sodipodi:star> implementation
33 #include "sp-star.h"
72 repr->setAttribute("sodipodi:type", "star");
309 sp_star_get_curvepoint (SPStar *star, SPStarPoint point, gint index, bool previ)
312 Geom::Point o = sp_star_get_xy (star, point, index);
315 gint pi = (index > 0)? (index - 1) : (star->sides - 1);
316 gint ni = (index < star->sides - 1)? (index + 1) : 0;
321 // the neighbors of o; depending on flatsided, they're either the same type (polygon) or the other type (star)
322 Geom::Point prev = (star->flatsided? sp_star_get_xy (star, point, pi) : sp_star_get_xy (star, other, point == SP_STAR_POINT_KNOT2? index : pi));
323 Geom::Point next = (star->flatsided? sp_star_get_xy (star, point, ni) : sp_star_get_xy (star, other, point == SP_STAR_POINT_KNOT1? index : ni));
329 // it's far enough outside the star on the perpendicular to prev-next through mid
339 // multiply rot by star->rounded coefficient and the distance to the star point; flip for next
342 ret = (star->rounded * prev_len) * rot;
344 ret = (star->rounded * next_len * -1) * rot;
347 if (star->randomized == 0) {
355 ret = ret * Geom::Affine (Geom::Rotate (star->randomized * M_PI * rnd (seed, 3)));
356 ret *= ( 1 + star->randomized * rnd (seed, 4));
359 Geom::Point o_randomized = sp_star_get_xy (star, point, index, true);
373 g_warning ("The star shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as star will remove the bad LPE");
469 sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized)
471 g_return_if_fail (star != NULL);
472 g_return_if_fail (SP_IS_STAR (star));
474 star->sides = CLAMP(sides, 3, 1024);
475 star->center = center;
476 star->r[0] = MAX (r1, 0.001);
479 star->r[1] = CLAMP(r2, 0.0, star->r[0]);
481 star->r[1] = CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] );
484 star->arg[0] = arg1;
485 star->arg[1] = arg2;
486 star->flatsided = isflat;
487 star->rounded = rounded;
488 star->randomized = randomized;
489 star->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
493 // We will determine the star's midpoint ourselves, instead of trusting on the base class
520 /* Calculate star start in parent coords. */
564 * @star: star item
573 sp_star_get_xy (SPStar const *star, SPStarPoint point, gint index, bool randomized)
575 gdouble darg = 2.0 * M_PI / (double) star->sides;
577 double arg = star->arg[point];
580 Geom::Point xy = star->r[point] * Geom::Point(cos(arg), sin(arg)) + star->center;
582 if (!randomized || star->randomized == 0) {
588 // the full range (corresponding to star->randomized == 1.0) is equal to the star's diameter
589 double range = 2 * MAX (star->r[0], star->r[1]);
591 Geom::Point shift (star->randomized * range * rnd (seed, 1), star->randomized * range * rnd (seed, 2));