int DrawManip::move(CEvent &e, State *&s) { if (!_cmd) return 0; // XXX - needs work, doing plane constraint ATM... if (plane().is_valid()) { apply_translation(plane().intersect(ptr_ray()) - _down_pt); return 0; } // XXX - need comments... CRV_SKETCHptr cs = CRV_SKETCH::get_instance(); if (cs->is_active() & _down) { Bcurve* curve = cs->curve(); Wpt_listMap* map = cs->shadow_map(); Wpt pt = Wpt(curve->shadow_plane(), Wline(ptr_cur())); if (_first) map->set_p0(new WptMap(pt)); else map->set_p1(new WptMap(pt)); map->recompute(); SurfaceCurveMap* o = (SurfaceCurveMap*)curve->map(); Wpt first = o->map(0), last = o->map(1); if (curve->b1()) { curve->b1()->move_to(first); } if (curve->b2()) { curve->b2()->move_to(last); } cs->reset_timeout(); return 0; } return 0; }
void CIRCLE_WIDGET::make_preview( void ) { _preview.clear(); // Get a coordinate system Wvec Z = _plane.normal(); Wvec X = Z.perpend(); Wvec Y = cross(Z,X); Wtransf xf(_center, X, Y, Z); // Make the hi-res circle for the curve's map1d3d: const int ORIG_RES = 256; _preview.realloc(ORIG_RES + 1); double dt = (2*M_PI)/ORIG_RES; for (int i=0; i<ORIG_RES; i++) { double t = dt*i; _preview += xf*Wpt(_radius*cos(t), _radius*sin(t), 0); } _preview += _preview[0]; // make it closed if( _suggest_active ) { return; } if( _circle == 0 ) { // XXX - no undo! should fix _circle = PanelAction::create( _plane, _center, _radius, TEXBODY::get_skel_mesh(0), _disk_res, 0 ); } else { Bcurve *border = Bcurve::lookup(_circle->bfaces().get_boundary().edges()); if( border != 0 ) { Wpt_listMap *map = Wpt_listMap::upcast(border->map()); if( map ) map->set_pts(_preview); } } }