@@ -110,6 +110,8 @@ def location(self):
110110 Setting this location will make a copy of the provided point object.
111111 Moving the original point will thus not affect the object's location.
112112 """
113+ if not self ._location :
114+ self ._location = Point (0 , 0 , 0 )
113115 return self ._location
114116
115117 @location .setter
@@ -122,6 +124,8 @@ def scale(self):
122124 A uniform scaling factor for the object in the scene.
123125 The scale is applied relative to the location of the object in the scene.
124126 """
127+ if not self ._scale :
128+ self ._scale = 1.0
125129 return self ._scale
126130
127131 @scale .setter
@@ -134,6 +138,8 @@ def rotation(self):
134138 The rotation angles around the 3 axis of the coordinate system
135139 with the origin placed at the location of the object in the scene.
136140 """
141+ if not self ._rotation :
142+ self ._rotation = [0 , 0 , 0 ]
137143 return self ._rotation
138144
139145 @rotation .setter
@@ -143,24 +149,24 @@ def rotation(self, rotation):
143149 @property
144150 def vertex_xyz (self ):
145151 """dict : The view coordinates of the volmesh object."""
152+ origin = Point (0 , 0 , 0 )
146153 stack = []
147- if self .anchor is not None and self .location is not None :
148- xyz = self .volmesh .vertex_attributes (self .anchor , 'xyz' )
149- origin = Point (0 , 0 , 0 )
150- point = Point (* xyz )
151- T1 = Translation .from_vector (origin - point )
152- stack .append (T1 )
153- if self .scale is not None :
154+ if self .scale != 1.0 :
154155 S = Scale .from_factors ([self .scale ] * 3 )
155156 stack .append (S )
156- if self .rotation is not None :
157+ if self .rotation != [ 0 , 0 , 0 ] :
157158 R = Rotation .from_euler_angles (self .rotation )
158159 stack .append (R )
159- if self .location is not None :
160+ if self .location != origin :
161+ if self .anchor is not None :
162+ xyz = self .volmesh .vertex_attributes (self .anchor , 'xyz' )
163+ point = Point (* xyz )
164+ T1 = Translation .from_vector (origin - point )
165+ stack .insert (0 , T1 )
160166 T2 = Translation .from_vector (self .location )
161167 stack .append (T2 )
162168 if stack :
163- X = reduce (mul , stack )
169+ X = reduce (mul , stack [:: - 1 ] )
164170 volmesh = self .volmesh .transformed (X )
165171 else :
166172 volmesh = self .volmesh
0 commit comments