public bool CheckConstraint(Behaviors.ValidateFunctionArguments validateFunctionArguments, CheckConstraintArguments checkConstraintArguments) { if (this.UpstreamConstraint != null) { if (!this.UpstreamConstraint.CheckConstraint(validateFunctionArguments, checkConstraintArguments)) { return(false); } } if (!validateFunctionArguments.ActionsApplied.Contains(Behaviors.ActionsApplied.Translate)) { // Ignore if no translate applied return(true); } Vector3D rotation, scale, translation; Matrix4x4Utils.Decompose(validateFunctionArguments.Transform , out scale , out rotation , out translation); var translation2 = new Vector2D(translation.x, translation.y); var result = translation2.x >= this.Minimum.x && translation2.y >= this.Minimum.y && translation2.x <= this.Maximum.x && translation2.y <= this.Maximum.y; return(result); }
public bool CheckConstraint(Behaviors.ValidateFunctionArguments validateFunctionArguments, CheckConstraintArguments checkConstraintArguments) { if (this.UpstreamConstraint != null) { if (!this.UpstreamConstraint.CheckConstraint(validateFunctionArguments, checkConstraintArguments)) { return(false); } } if (!validateFunctionArguments.ActionsApplied.Contains(Behaviors.ActionsApplied.Rotate)) { // Ignore if no rotation applied return(true); } Vector3D rotation, scale, translation; Matrix4x4Utils.Decompose(validateFunctionArguments.Transform , out scale , out rotation , out translation); return(rotation.z / (Math.PI * 2.0) >= this.Minimum && rotation.z / (Math.PI * 2.0) <= this.Maximum); }