1
1
/*
2
- Copyright (c) 2024 Stephen Gold
2
+ Copyright (c) 2024-2025 Stephen Gold
3
3
4
4
Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,14 @@ public class VertexAttributes
36
36
// *************************************************************************
37
37
// constructors
38
38
39
+ /**
40
+ * Instantiate default attributes.
41
+ */
42
+ public VertexAttributes () {
43
+ long attributesVa = createDefault ();
44
+ setVirtualAddress (attributesVa , () -> free (attributesVa ));
45
+ }
46
+
39
47
/**
40
48
* Instantiate attributes as specified.
41
49
*
@@ -90,6 +98,48 @@ public VertexAttributes(float compliance, float shearCompliance,
90
98
setVirtualAddress (attributesVa , () -> free (attributesVa ));
91
99
}
92
100
// *************************************************************************
101
+ // new methods exposed
102
+
103
+ /**
104
+ * Alter the compliance of normal/regular edges. (native attribute:
105
+ * mCompliance)
106
+ *
107
+ * @param compliance the desired compliance value
108
+ * @return the argument, for chaining
109
+ */
110
+ public float setCompliance (float compliance ) {
111
+ long attributesVa = va ();
112
+ setCompliance (attributesVa , compliance );
113
+
114
+ return compliance ;
115
+ }
116
+
117
+ /**
118
+ * Alter the type of the long-range attachment (LRA) constraint. (native
119
+ * attribute: mLRAType)
120
+ *
121
+ * @param type the desired type (not null)
122
+ */
123
+ public void setLraType (ELraType type ) {
124
+ long attributesVa = va ();
125
+ int ordinal = type .ordinal ();
126
+ setLraType (attributesVa , ordinal );
127
+ }
128
+
129
+ /**
130
+ * Alter the compliance of the shear edges. (native attribute:
131
+ * mShearCompliance)
132
+ *
133
+ * @param compliance the desired compliance value
134
+ * @return the argument, for chaining
135
+ */
136
+ public float setShearCompliance (float compliance ) {
137
+ long attributesVa = va ();
138
+ setShearCompliance (attributesVa , compliance );
139
+
140
+ return compliance ;
141
+ }
142
+ // *************************************************************************
93
143
// ConstVertexAttributes methods
94
144
95
145
/**
@@ -170,6 +220,8 @@ native private static long createAttributes(
170
220
float compliance , float shearCompliance , float bendCompliance ,
171
221
int ordinal , float lraMultiplier );
172
222
223
+ native private static long createDefault ();
224
+
173
225
native private static void free (long attributesVa );
174
226
175
227
native private static float getBendCompliance (long attributesVa );
@@ -181,4 +233,12 @@ native private static long createAttributes(
181
233
native private static int getLraType (long attributesVa );
182
234
183
235
native private static float getShearCompliance (long attributesVa );
236
+
237
+ native private static void setCompliance (
238
+ long attributesVa , float compliance );
239
+
240
+ native private static void setLraType (long attributesVa , int ordinal );
241
+
242
+ native private static void setShearCompliance (
243
+ long attributesVa , float compliance );
184
244
}
0 commit comments