twndel: fix y axis point move
This commit is contained in:
		| @@ -200,8 +200,7 @@ static bool find_closest_point(uint8_t* object_result, uint16_t *point_result) { | |||||||
|                 float ray_dist = vec3_length(b); |                 float ray_dist = vec3_length(b); | ||||||
|                 if (ray_dist > ((float)SELECTION_SPHERE_RADIUS / POINTS_PER_METER)) |                 if (ray_dist > ((float)SELECTION_SPHERE_RADIUS / POINTS_PER_METER)) | ||||||
|                     continue; |                     continue; | ||||||
|                 Vec3 i = vec3_add(p, b); |                 float dist = vec3_length(vec3_add(p, b)); | ||||||
|                 float dist = vec3_length(i); |  | ||||||
|                 if (dist < closest_distance) { |                 if (dist < closest_distance) { | ||||||
|                     closest_distance = dist; |                     closest_distance = dist; | ||||||
|                     closest_obj = obj; |                     closest_obj = obj; | ||||||
| @@ -225,6 +224,7 @@ static bool find_closest_point(uint8_t* object_result, uint16_t *point_result) { | |||||||
|  |  | ||||||
| static void process_operation_move_point(Operation *op) { | static void process_operation_move_point(Operation *op) { | ||||||
|     /* finish dragging around */ |     /* finish dragging around */ | ||||||
|  |     /* TODO: dont keep empty ops on stack? */ | ||||||
|     if (input_action_just_released("select")) { |     if (input_action_just_released("select")) { | ||||||
|         state.op_active = false; |         state.op_active = false; | ||||||
|         return; |         return; | ||||||
| @@ -246,13 +246,15 @@ static void process_operation_move_point(Operation *op) { | |||||||
|  |  | ||||||
|     /* TODO: show thresholds */ |     /* TODO: show thresholds */ | ||||||
|  |  | ||||||
|  |     log_vec3(b, "cross"); | ||||||
|  |  | ||||||
|     /* change along axes, delta is accumulated when threshold is met*/ |     /* change along axes, delta is accumulated when threshold is met*/ | ||||||
|     int16_t xch = (int16_t)(floorf(vec3_dot(b, (Vec3){0,0,1}) * (float)POINTS_PER_METER)) * !state.axis_mask[0]; |     int16_t xch = (int16_t)(floorf(vec3_dot(b, (Vec3){0,0,1}) * (float)POINTS_PER_METER)) * !state.axis_mask[0]; | ||||||
|     xch -= xch % state.grid_snap_granularity; |     xch -= xch % state.grid_snap_granularity; | ||||||
|     state.points[op->data.move_point.point].x += xch; |     state.points[op->data.move_point.point].x += xch; | ||||||
|     op->data.move_point.delta_x += xch; |     op->data.move_point.delta_x += xch; | ||||||
|  |  | ||||||
|     int16_t ych = (int16_t)(floorf(vec3_dot(b, (Vec3){0,-1,0}) * (float)POINTS_PER_METER)) * !state.axis_mask[1]; |     int16_t ych = (int16_t)(floorf(vec3_dot(vec3_cross(b, pos_and_ray.direction), (Vec3){0,-1,0}) * (float)POINTS_PER_METER)) * !state.axis_mask[1]; | ||||||
|     ych -= ych % state.grid_snap_granularity; |     ych -= ych % state.grid_snap_granularity; | ||||||
|     state.points[op->data.move_point.point].y += ych; |     state.points[op->data.move_point.point].y += ych; | ||||||
|     op->data.move_point.delta_y += ych; |     op->data.move_point.delta_y += ych; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user