q_recognizer/point.rs
1/**
2 * The $P Point-Cloud Recognizer (rust version)
3 *
4 * Translated to rust from the original authors' C# code with an AI tool.
5 * The translated code has been reviewed by Ferran Pujol Camins.
6 *
7 * Original authors:
8 *
9 * Radu-Daniel Vatavu, Ph.D.
10 * University Stefan cel Mare of Suceava
11 * Suceava 720229, Romania
12 * vatavu@eed.usv.ro
13 *
14 * Lisa Anthony, Ph.D.
15 * UMBC
16 * Information Systems Department
17 * 1000 Hilltop Circle
18 * Baltimore, MD 21250
19 * lanthony@umbc.edu
20 *
21 * Jacob O. Wobbrock, Ph.D.
22 * The Information School
23 * University of Washington
24 * Seattle, WA 98195-2840
25 * wobbrock@uw.edu
26 *
27 * The academic publication for the $P recognizer, and what should be
28 * used to cite it, is:
29 *
30 * Vatavu, R.-D., Anthony, L. and Wobbrock, J.O. (2012).
31 * Gestures as point clouds: A $P recognizer for user interface
32 * prototypes. Proceedings of the ACM Int'l Conference on
33 * Multimodal Interfaces (ICMI '12). Santa Monica, California
34 * (October 22-26, 2012). New York: ACM Press, pp. 273-280.
35 *
36 * This software is distributed under the "New BSD License" agreement:
37 *
38 * Copyright (c) 2012, Radu-Daniel Vatavu, Lisa Anthony, and
39 * Jacob O. Wobbrock. All rights reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions are met:
43 * * Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * * Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * * Neither the names of the University Stefan cel Mare of Suceava,
49 * University of Washington, nor UMBC, nor the names of its contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
54 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
55 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Radu-Daniel Vatavu OR Lisa Anthony
57 * OR Jacob O. Wobbrock OR Ferran Pujol Camins BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
58 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
59 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
61 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64**/
65
66#[derive(Clone)]
67pub struct Point {
68 pub x: f32,
69 pub y: f32,
70 pub stroke_id: i32,
71 pub int_x: i32,
72 pub int_y: i32,
73}
74
75impl Point {
76 pub fn new(x: f32, y: f32, stroke_id: i32) -> Self {
77 Self {
78 x,
79 y,
80 stroke_id,
81 int_x: 0,
82 int_y: 0,
83 }
84 }
85}