11/*
2- Copyright (c) 2024 Stephen Gold
2+ Copyright (c) 2024-2025 Stephen Gold
33
44Permission is hereby granted, free of charge, to any person obtaining a copy
55of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,14 @@ public class VertexAttributes
3636 // *************************************************************************
3737 // constructors
3838
39+ /**
40+ * Instantiate default attributes.
41+ */
42+ public VertexAttributes () {
43+ long attributesVa = createDefault ();
44+ setVirtualAddress (attributesVa , () -> free (attributesVa ));
45+ }
46+
3947 /**
4048 * Instantiate attributes as specified.
4149 *
@@ -90,6 +98,48 @@ public VertexAttributes(float compliance, float shearCompliance,
9098 setVirtualAddress (attributesVa , () -> free (attributesVa ));
9199 }
92100 // *************************************************************************
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+ // *************************************************************************
93143 // ConstVertexAttributes methods
94144
95145 /**
@@ -170,6 +220,8 @@ native private static long createAttributes(
170220 float compliance , float shearCompliance , float bendCompliance ,
171221 int ordinal , float lraMultiplier );
172222
223+ native private static long createDefault ();
224+
173225 native private static void free (long attributesVa );
174226
175227 native private static float getBendCompliance (long attributesVa );
@@ -181,4 +233,12 @@ native private static long createAttributes(
181233 native private static int getLraType (long attributesVa );
182234
183235 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 );
184244}
0 commit comments