Subversion Repositories DIN Is Noise

Rev

Rev 1532 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1528 jag 1
/*
2
* hit.h
3
* DIN Is Noise is copyright (c) 2006-2020 Jagannathan Sampath
4
* For more information, please visit https://dinisnoise.org/
5
*/
6
 
7
#ifndef __hit
8
#define __hit
9
 
10
#include "point.h"
11
 
12
struct multi_curve;
13
struct hit_t {
14
  multi_curve* crv; // curve hit
15
  int crv_id; // id among list of curves
16
  enum {NONE = 0, VERTEX, LEFT_TANGENT, RIGHT_TANGENT}; // things that can be hit
17
  int what; // what was hit
18
  int id; // id of hit thing
19
 
20
  static int name_only;
21
 
22
  // tangent vectors from corresponding vertex
23
  //
24
  point<float> left_tangent, right_tangent;
25
  float left_tangent_magnitude, right_tangent_magnitude;
26
 
27
  hit_t (multi_curve* c = 0, int cid = -1, int w = NONE, int i = -1, int no = 0);
28
  hit_t (const hit_t& h);
29
  void clear ();
30
  int operator()() const; // hit?
31
  int operator()(int) const; // hit curve item exists?
32
  int operator== (const hit_t& h) {return ((crv == h.crv) && (what == h.what) && (id == h.id));}
33
  int matched_id (const hit_t& h) {return ( (crv == h.crv) && (id == h.id) ); }
34
  void ensure_id ();
35
  hit_t& operator= (const hit_t& h);
36
  void copy (const hit_t& src);
37
  const point<float>& get ();
38
};
39
#endif