ShapeRotator: an R package for standardised rigid rotations of articulated Three-Dimensional structures with application for geometric morphometrics

The quantification of complex morphological patterns typically involves comprehensive shape and size analyses, usually obtained by gathering morphological data from all the structures that capture the phenotypic diversity in an organism or object. Articulated structures are a critical component of overall phenotypic diversity, but data gathered from these structures is difficult to incorporate in to modern analyses because of the complexities associated with jointly quantifying 3D shape in multiple structures. While there are existing methods for analysing shape variation in articulated structures in Two-Dimensional (2D) space, these methods do not work in 3D, a rapidly growing area of capability and research. Here we describe a simple geometric rigid rotation approach that removes the effect of random translation and rotations, enabling the morphological analysis of 3D articulated structures. Our method is based on Cartesian coordinates in 3D space so it can be applied to any morphometric problem that also uses 3D coordinates (e.g. spherical harmonics). We demonstrate the method by applying it to a landmark-based data set for analysing shape variation using geometric morphometrics. We have developed an R package (ShapeRotator) so that the method can be easily implemented in the commonly used software programs geomorph and MorphoJ. This method will be a valuable tool for 3D morphological analyses in articulated structures by allowing an exhaustive examination of shape and size diversity.

1. The quantification of complex morphological patterns typically involves comprehensive shape 23 and size analyses, usually obtained by gathering morphological data from all the structures 24 that capture the phenotypic diversity in an organism or object. Articulated structures are a 25 critical component of overall phenotypic diversity, but data gathered from these structures is 26 difficult to incorporate in to modern analyses because of the complexities associated with 27 jointly quantifying 3D shape in multiple structures.  3. Here we describe a simple geometric rigid rotation approach that removes the effect of 32 random translation and rotations, enabling the morphological analysis of 3D articulated 33 structures. Our method is based on Cartesian coordinates in 3D space so it can be applied to 34 any morphometric problem that also uses 3D coordinates (e.g. spherical harmonics). We 35 demonstrate the method by applying it to a landmark-based data set for analysing shape 36 variation using geometric morphometrics.

Background 44
Data on shape and size variation is essential in many fields, including evolutionary biology 45 and ecology, engineering, medical science, and anthropology (Loncaric 1998 Slice 2006). For most of these studies, one of the most widely used tools for analysing 47 morphological variation within or between a group of organisms or objects are based on Cartesian 48 coordinates of landmarks (Bookstein 1997).

49
Of the wide array of methods using Cartesian coordinates, geometric morphometrics (GM) is the 50 most common, especially when analysing shape and size variation and covariation (Mitteroecker &

58
3D morphological analyses are the most accurate, as objects and organisms exist in 3D space. The 59 recent growth in x-ray micro CT scanning and surface scanning has seen a rapid increase in the 60 application of 3D geometric morphometric techniques, but progress has been hampered by the lack of a 61 simple method to incorporate data from complex articulated structures.

62
In evolutionary biology, identifying morphological differences among different groups or taxa is 63 crucial in order to understand evolutionary processes and their relationship to the environment (Losos

77
Unfortunately, non-rigid structures, such as articulated structures, will inevitably suffer the effects 78 of natural or free rotation or translation events and be different in each individual and structure 79 (Adams, 1999). These events could obstruct the correct quantification of shape variation by adding 80 rotation artifacts to GM analyses (Adams et al. 2004). Thus, orientation of these structures needs to be 81 corrected and standardised prior to performing shape analyses. Methods for shape analysis of landmark 82 data in articulated structures already have been described but the solution to this problem has been 83 implemented only in two-dimensional (2D) space (Adams, 1999).

84
Here we present the R package ShapeRotator: a simple geometric rigid rotation approach to study 85 3-Dimensional (3D) shape of articulated structures, or independent structures, within an organism. We 86 describe a method that removes shape variation due to the effect of translation between independent 87 structures and rotation generated by movement in an articulation, among others. Thus, our approach 88 translates and rotates articulated (or even independent) structures in order to obtain a comparable shape 89 data set once all effects of random movement and rotations have been removed (Fig. 1a).

90
We apply this method to a landmark-based data set for analysing shape variation using geometric

Methodology 104
We begin with a set of points P = {p0, … , pM} ∁ ℝ 3 which represents a 3D object, and are 105 ordered so that p0 represents the base point and p represents the end point, by which we mean that 106 this object has an axis starting from p 0 and ending at p . Our goal is to rotate these points via a rigid 107 motion so that the axis on which these two points sit is either on the , or -axis in ℝ 3 . Rotation of 108 vectors in ℝ 3 is a well-known and easily resolved problem, and various formalisms exist in geometry.

109
Thus, we translate our set of points P so that p 0 maps to the origin (0, 0, 0). This is a simple and within this plane (Fig. 1b). Such a rotation is done via rotating on the axis to the plane, which 119 is determined by a normal vector to this plane.

120
Let us describe this set-up slightly more generally. For two vectors , ∈ ℝ 3 , the axis to the plane 121 spanned by these two vectors is determined by a unit normal to the plane (there are two choices due to 122 orientation), which we denote by ( , ):

137
It may be necessary to introduce a further constraint in the rotation. For instance, suppose = (0, 1, 0) 138 and there is a point , now rotated to via the method we describe, which should lie in the -axis.

139
That is, we need to further rotate to a point ′ = ( * , * , 0). To do this, we simply rotate in the axis ,  2). This tutorial uses the example data set, which is included in this package.

154
Importing a data set

155
In the example data set we use two geometric morphometric data sets containing both 156 landmarks and semi-landmarks for two neighbouring and articulated bones (humerus and radioulna) 157 from a group of several species of frogs (details in Appendix S1), in tps format. We first import the

Other applications 228
Our method is an important addition to the tool kit of the geometric morphometrics field. It will 229 facilitate the analyses of compound 3D morphological datasets in geometric morphometrics analyses 230 but will also be useful outside of this field as it can be applied to any method that uses 3D coordinates.

231
The examples of applications are numerous in different fields of study, such as biology, anthropology, Step 1: importing the data and fixating the rotation axes; Step 2: translating the whole data set 291 of coordinates or points so that the main selected point p 0 = (0, 0, 0), with the function translate(); and

292
Step 3: rotating the two structures to the desired angle (e.g. 90 degrees), with the function rotator().