|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- ÿþu�s�i�n�g� �U�n�i�t�y�E�n�g�i�n�e�;�
- �u�s�i�n�g� �S�y�s�t�e�m�.�C�o�l�l�e�c�t�i�o�n�s�;�
- �u�s�i�n�g� �S�y�s�t�e�m�.�C�o�l�l�e�c�t�i�o�n�s�.�G�e�n�e�r�i�c�;�
- �
- �p�u�b�l�i�c� �c�l�a�s�s� �L�i�n�e�S�m�o�o�t�h�e�r� �:� �M�o�n�o�B�e�h�a�v�i�o�u�r� �
- �{�
- � �p�u�b�l�i�c� �s�t�a�t�i�c� �V�e�c�t�o�r�3�[�]� �S�m�o�o�t�h�L�i�n�e�(� �V�e�c�t�o�r�3�[�]� �i�n�p�u�t�P�o�i�n�t�s�,� �f�l�o�a�t� �s�e�g�m�e�n�t�S�i�z�e� �)�
- � �{�
- � � �/�/�c�r�e�a�t�e� �c�u�r�v�e�s�
- � � �A�n�i�m�a�t�i�o�n�C�u�r�v�e� �c�u�r�v�e�X� �=� �n�e�w� �A�n�i�m�a�t�i�o�n�C�u�r�v�e�(�)�;�
- � � �A�n�i�m�a�t�i�o�n�C�u�r�v�e� �c�u�r�v�e�Y� �=� �n�e�w� �A�n�i�m�a�t�i�o�n�C�u�r�v�e�(�)�;�
- � � �A�n�i�m�a�t�i�o�n�C�u�r�v�e� �c�u�r�v�e�Z� �=� �n�e�w� �A�n�i�m�a�t�i�o�n�C�u�r�v�e�(�)�;�
- �
- � � �/�/�c�r�e�a�t�e� �k�e�y�f�r�a�m�e� �s�e�t�s�
- � � �K�e�y�f�r�a�m�e�[�]� �k�e�y�s�X� �=� �n�e�w� �K�e�y�f�r�a�m�e�[�i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h�]�;�
- � � �K�e�y�f�r�a�m�e�[�]� �k�e�y�s�Y� �=� �n�e�w� �K�e�y�f�r�a�m�e�[�i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h�]�;�
- � � �K�e�y�f�r�a�m�e�[�]� �k�e�y�s�Z� �=� �n�e�w� �K�e�y�f�r�a�m�e�[�i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h�]�;�
- �
- � � �/�/�s�e�t� �k�e�y�f�r�a�m�e�s�
- � � �f�o�r�(� �i�n�t� �i� �=� �0�;� �i� �<� �i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h�;� �i�+�+� �)�
- � � �{�
- � � � �k�e�y�s�X�[�i�]� �=� �n�e�w� �K�e�y�f�r�a�m�e�(� �i�,� �i�n�p�u�t�P�o�i�n�t�s�[�i�]�.�x� �)�;�
- � � � �k�e�y�s�Y�[�i�]� �=� �n�e�w� �K�e�y�f�r�a�m�e�(� �i�,� �i�n�p�u�t�P�o�i�n�t�s�[�i�]�.�y� �)�;�
- � � � �k�e�y�s�Z�[�i�]� �=� �n�e�w� �K�e�y�f�r�a�m�e�(� �i�,� �i�n�p�u�t�P�o�i�n�t�s�[�i�]�.�z� �)�;�
- � � �}�
- �
- � � �/�/�a�p�p�l�y� �k�e�y�f�r�a�m�e�s� �t�o� �c�u�r�v�e�s�
- � � �c�u�r�v�e�X�.�k�e�y�s� �=� �k�e�y�s�X�;�
- � � �c�u�r�v�e�Y�.�k�e�y�s� �=� �k�e�y�s�Y�;�
- � � �c�u�r�v�e�Z�.�k�e�y�s� �=� �k�e�y�s�Z�;�
- �
- � � �/�/�s�m�o�o�t�h� �c�u�r�v�e� �t�a�n�g�e�n�t�s�
- � � �f�o�r�(� �i�n�t� �i� �=� �0�;� �i� �<� �i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h�;� �i�+�+� �)�
- � � �{�
- � � � �c�u�r�v�e�X�.�S�m�o�o�t�h�T�a�n�g�e�n�t�s�(� �i�,� �0� �)�;�
- � � � �c�u�r�v�e�Y�.�S�m�o�o�t�h�T�a�n�g�e�n�t�s�(� �i�,� �0� �)�;�
- � � � �c�u�r�v�e�Z�.�S�m�o�o�t�h�T�a�n�g�e�n�t�s�(� �i�,� �0� �)�;�
- � � �}�
- �
- � � �/�/�l�i�s�t� �t�o� �w�r�i�t�e� �s�m�o�o�t�h�e�d� �v�a�l�u�e�s� �t�o�
- � � �L�i�s�t�<�V�e�c�t�o�r�3�>� �l�i�n�e�S�e�g�m�e�n�t�s� �=� �n�e�w� �L�i�s�t�<�V�e�c�t�o�r�3�>�(�)�;�
- �
- � � �/�/�f�i�n�d� �s�e�g�m�e�n�t�s� �i�n� �e�a�c�h� �s�e�c�t�i�o�n�
- � � �f�o�r�(� �i�n�t� �i� �=� �0�;� �i� �<� �i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h�;� �i�+�+� �)�
- � � �{�
- � � � �/�/�a�d�d� �f�i�r�s�t� �p�o�i�n�t�
- � � � �l�i�n�e�S�e�g�m�e�n�t�s�.�A�d�d�(� �i�n�p�u�t�P�o�i�n�t�s�[�i�]� �)�;�
- �
- � � � �/�/�m�a�k�e� �s�u�r�e� �w�i�t�h�i�n� �r�a�n�g�e� �o�f� �a�r�r�a�y�
- � � � �i�f�(� �i�+�1� �<� �i�n�p�u�t�P�o�i�n�t�s�.�L�e�n�g�t�h� �)�
- � � � �{�
- � � � � �/�/�f�i�n�d� �d�i�s�t�a�n�c�e� �t�o� �n�e�x�t� �p�o�i�n�t�
- � � � � �f�l�o�a�t� �d�i�s�t�a�n�c�e�T�o�N�e�x�t� �=� �V�e�c�t�o�r�3�.�D�i�s�t�a�n�c�e�(�i�n�p�u�t�P�o�i�n�t�s�[�i�]�,� �i�n�p�u�t�P�o�i�n�t�s�[�i�+�1�]�)�;�
- �
- � � � � �/�/�n�u�m�b�e�r� �o�f� �s�e�g�m�e�n�t�s�
- � � � � �i�n�t� �s�e�g�m�e�n�t�s� �=� �(�i�n�t�)�(�d�i�s�t�a�n�c�e�T�o�N�e�x�t� �/� �s�e�g�m�e�n�t�S�i�z�e�)�;�
- �
- � � � � �/�/�a�d�d� �s�e�g�m�e�n�t�s�
- � � � � �f�o�r�(� �i�n�t� �s� �=� �1�;� �s� �<� �s�e�g�m�e�n�t�s�;� �s�+�+� �)�
- � � � � �{�
- � � � � � �/�/�i�n�t�e�r�p�o�l�a�t�e�d� �t�i�m�e� �o�n� �c�u�r�v�e�
- � � � � � �f�l�o�a�t� �t�i�m�e� �=� �(�(�f�l�o�a�t�)�s�/�(�f�l�o�a�t�)�s�e�g�m�e�n�t�s�)� �+� �(�f�l�o�a�t�)�i�;�
- �
- � � � � � �/�/�s�a�m�p�l�e� �c�u�r�v�e�s� �t�o� �f�i�n�d� �s�m�o�o�t�h�e�d� �p�o�s�i�t�i�o�n�
- � � � � � �V�e�c�t�o�r�3� �n�e�w�S�e�g�m�e�n�t� �=� �n�e�w� �V�e�c�t�o�r�3�(� �c�u�r�v�e�X�.�E�v�a�l�u�a�t�e�(�t�i�m�e�)�,� �c�u�r�v�e�Y�.�E�v�a�l�u�a�t�e�(�t�i�m�e�)�,� �c�u�r�v�e�Z�.�E�v�a�l�u�a�t�e�(�t�i�m�e�)� �)�;�
- �
- � � � � � �/�/�a�d�d� �t�o� �l�i�s�t�
- � � � � � �l�i�n�e�S�e�g�m�e�n�t�s�.�A�d�d�(� �n�e�w�S�e�g�m�e�n�t� �)�;�
- � � � � �}�
- � � � �}�
- � � �}�
- �
- � � �r�e�t�u�r�n� �l�i�n�e�S�e�g�m�e�n�t�s�.�T�o�A�r�r�a�y�(�)�;�
- � �}�
- �
- �}�
- �
|