[DEV] add some tools
This commit is contained in:
parent
daa001d9d9
commit
ea862edd8c
110
CleanUp.xml
110
CleanUp.xml
@ -1,66 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE xml>
|
||||
<profiles version="2">
|
||||
<profile kind="CleanUpProfile" name="Scenarium" version="2">
|
||||
<profile kind="CleanUpProfile" name="EWOL" version="2">
|
||||
<setting id="cleanup.use_autoboxing" value="false"/>
|
||||
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
|
||||
<setting id="cleanup.organize_imports" value="true"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
|
||||
<setting id="cleanup.format_source_code_changes_only" value="false"/>
|
||||
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
|
||||
<setting id="cleanup.remove_redundant_semicolons" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.useless_continue" value="false"/>
|
||||
<setting id="cleanup.remove_redundant_type_arguments" value="true"/>
|
||||
<setting id="cleanup.remove_unused_imports" value="true"/>
|
||||
<setting id="cleanup.insert_inferred_type_arguments" value="false"/>
|
||||
<setting id="cleanup.make_private_fields_final" value="true"/>
|
||||
<setting id="cleanup.break_loop" value="false"/>
|
||||
<setting id="cleanup.pull_up_assignment" value="false"/>
|
||||
<setting id="cleanup.stringbuilder" value="false"/>
|
||||
<setting id="cleanup.no_super" value="false"/>
|
||||
<setting id="cleanup.arrays_fill" value="false"/>
|
||||
<setting id="cleanup.use_lambda" value="true"/>
|
||||
<setting id="cleanup.always_use_blocks" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
|
||||
<setting id="cleanup.simplify_lambda_expression_and_method_ref" value="false"/>
|
||||
<setting id="cleanup.always_use_blocks" value="true"/>
|
||||
<setting id="cleanup.sort_members_all" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
|
||||
<setting id="cleanup.instanceof" value="false"/>
|
||||
<setting id="cleanup.add_missing_annotations" value="true"/>
|
||||
<setting id="cleanup.precompile_regex" value="false"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.make_parameters_final" value="false"/>
|
||||
<setting id="cleanup.sort_members" value="false"/>
|
||||
<setting id="cleanup.remove_private_constructors" value="true"/>
|
||||
<setting id="cleanup.boolean_literal" value="false"/>
|
||||
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
|
||||
<setting id="cleanup.sort_members" value="false"/>
|
||||
<setting id="cleanup.remove_unused_local_variables" value="false"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
|
||||
<setting id="cleanup.remove_unused_private_fields" value="true"/>
|
||||
<setting id="cleanup.remove_redundant_modifiers" value="false"/>
|
||||
<setting id="cleanup.never_use_blocks" value="true"/>
|
||||
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.add_missing_nls_tags" value="false"/>
|
||||
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
|
||||
<setting id="cleanup.no_string_creation" value="false"/>
|
||||
<setting id="cleanup.use_unboxing" value="false"/>
|
||||
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
|
||||
<setting id="cleanup.format_source_code" value="true"/>
|
||||
<setting id="cleanup.convert_functional_interfaces" value="true"/>
|
||||
<setting id="cleanup.add_default_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_methods" value="true"/>
|
||||
<setting id="cleanup.if_condition" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
|
||||
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
|
||||
<setting id="cleanup.map_cloning" value="false"/>
|
||||
<setting id="cleanup.add_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.try_with_resource" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
|
||||
<setting id="cleanup.make_local_variable_final" value="false"/>
|
||||
<setting id="cleanup.add_missing_methods" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.add_missing_override_annotations" value="true"/>
|
||||
<setting id="cleanup.use_blocks" value="true"/>
|
||||
<setting id="cleanup.collection_cloning" value="false"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop_if_loop_var_used" value="false"/>
|
||||
<setting id="cleanup.make_variable_declarations_final" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_types" value="true"/>
|
||||
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.organize_imports" value="true"/>
|
||||
<setting id="cleanup.lazy_logical_operator" value="false"/>
|
||||
<setting id="cleanup.bitwise_conditional_expression" value="false"/>
|
||||
<setting id="cleanup.add_all" value="false"/>
|
||||
<setting id="cleanup.use_directly_map_method" value="false"/>
|
||||
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
|
||||
<setting id="cleanup.primitive_serialization" value="false"/>
|
||||
<setting id="cleanup.comparison_statement" value="false"/>
|
||||
<setting id="cleanup.insert_inferred_type_arguments" value="false"/>
|
||||
<setting id="cleanup.make_private_fields_final" value="true"/>
|
||||
<setting id="cleanup.useless_return" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_array_creation" value="false"/>
|
||||
<setting id="cleanup.remove_private_constructors" value="true"/>
|
||||
<setting id="cleanup.make_parameters_final" value="false"/>
|
||||
<setting id="cleanup.ternary_operator" value="false"/>
|
||||
<setting id="cleanup.merge_conditional_blocks" value="false"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
|
||||
<setting id="cleanup.remove_unused_private_fields" value="true"/>
|
||||
<setting id="cleanup.never_use_blocks" value="false"/>
|
||||
<setting id="cleanup.remove_redundant_modifiers" value="false"/>
|
||||
<setting id="cleanup.redundant_falling_through_block_end" value="false"/>
|
||||
<setting id="cleanup.switch" value="false"/>
|
||||
<setting id="cleanup.number_suffix" value="false"/>
|
||||
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
|
||||
<setting id="cleanup.convert_to_switch_expressions" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.add_missing_nls_tags" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
|
||||
<setting id="cleanup.objects_equals" value="false"/>
|
||||
<setting id="cleanup.convert_functional_interfaces" value="true"/>
|
||||
<setting id="cleanup.format_source_code" value="true"/>
|
||||
<setting id="cleanup.else_if" value="true"/>
|
||||
<setting id="cleanup.add_default_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_methods" value="true"/>
|
||||
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
|
||||
<setting id="cleanup.join" value="false"/>
|
||||
<setting id="cleanup.embedded_if" value="false"/>
|
||||
<setting id="cleanup.use_anonymous_class_creation" value="false"/>
|
||||
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_members" value="false"/>
|
||||
<setting id="cleanup.make_local_variable_final" value="false"/>
|
||||
<setting id="cleanup.add_missing_methods" value="false"/>
|
||||
<setting id="cleanup.strictly_equal_or_different" value="false"/>
|
||||
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.push_down_negation" value="false"/>
|
||||
<setting id="cleanup.evaluate_nullable" value="false"/>
|
||||
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.add_missing_override_annotations" value="true"/>
|
||||
<setting id="cleanup.use_blocks" value="true"/>
|
||||
<setting id="cleanup.make_variable_declarations_final" value="true"/>
|
||||
<setting id="cleanup.hash" value="false"/>
|
||||
<setting id="cleanup.double_negation" value="false"/>
|
||||
<setting id="cleanup.overridden_assignment" value="false"/>
|
||||
<setting id="cleanup.correct_indentation" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_types" value="true"/>
|
||||
<setting id="cleanup.use_var" value="false"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
416
Formatter.xml
416
Formatter.xml
@ -1,77 +1,237 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE xml>
|
||||
<profiles version="18">
|
||||
<profile kind="CodeFormatterProfile" name="Scenarium" version="18">
|
||||
<profiles version="20">
|
||||
<profile kind="CodeFormatterProfile" name="EWOL" version="20">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insertNew_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insertNew_line_before_root_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="48"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||
@ -81,284 +241,148 @@
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="200"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_onNew_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insertNew_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="33"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_beforeNew_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="33"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insertNew_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="200"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
|
@ -3,7 +3,7 @@ package org.atriasoft.etk.internal;
|
||||
import io.scenarium.logger.LogLevel;
|
||||
import io.scenarium.logger.Logger;
|
||||
|
||||
public class Log {
|
||||
class Log {
|
||||
private static final String LIB_NAME = "etk";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
||||
|
14
src/org/atriasoft/etk/math/Constant.java
Normal file
14
src/org/atriasoft/etk/math/Constant.java
Normal file
@ -0,0 +1,14 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
public class Constant {
|
||||
|
||||
private Constant() {
|
||||
}
|
||||
|
||||
// Machine epsilon
|
||||
public static final float MACHINE_EPSILON = 0.000001f;
|
||||
// Pi constant
|
||||
public static final float PI = 3.14159265f;
|
||||
// 2*Pi constant
|
||||
public static final float PI_2 = 6.28318530f;
|
||||
}
|
131
src/org/atriasoft/etk/math/FMath.java
Normal file
131
src/org/atriasoft/etk/math/FMath.java
Normal file
@ -0,0 +1,131 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
public class FMath {
|
||||
public static float abs(final float a) {
|
||||
if (a < 0.0f) {
|
||||
return -a;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the value id in the correct range
|
||||
* @param a fist value
|
||||
* @param b second value (a-b)
|
||||
* @return true if it is in the range
|
||||
*/
|
||||
public static boolean approxEqual(final float a, final float b) {
|
||||
return approxEqual(a, b, Constant.MACHINE_EPSILON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the value id in the correct range
|
||||
* @param a fist value
|
||||
* @param b second value (a-b)
|
||||
* @param epsilon delta to check
|
||||
* @return true if it is in the range
|
||||
*/
|
||||
public static boolean approxEqual(final float a, final float b, final float epsilon) {
|
||||
final float difference = a - b;
|
||||
return (abs(difference) < epsilon);
|
||||
}
|
||||
|
||||
public static float atan2(final float sinHalfAngleAbs, final float cosHalfAngle) {
|
||||
return (float) Math.atan2(sinHalfAngleAbs, cosHalfAngle);
|
||||
}
|
||||
|
||||
public static float avg(final float min, final float value, final float max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
}
|
||||
|
||||
/// Function that returns the result of the "value" clamped by
|
||||
/// two others values "lowerLimit" and "upperLimit"
|
||||
public static float clamp(final float value, final float lowerLimit, final float upperLimit) {
|
||||
assert (lowerLimit <= upperLimit);
|
||||
return FMath.min(FMath.max(value, lowerLimit), upperLimit);
|
||||
}
|
||||
|
||||
public static int clamp(final int value, final int lowerLimit, final int upperLimit) {
|
||||
assert (lowerLimit <= upperLimit);
|
||||
return FMath.min(FMath.max(value, lowerLimit), upperLimit);
|
||||
}
|
||||
|
||||
/// Function that returns the result of the "value" clamped by
|
||||
/// two others values "lowerLimit" and "upperLimit"
|
||||
public static long clamp(final long value, final long lowerLimit, final long upperLimit) {
|
||||
assert (lowerLimit <= upperLimit);
|
||||
return FMath.min(FMath.max(value, lowerLimit), upperLimit);
|
||||
}
|
||||
|
||||
// TODO check this basic function ...
|
||||
public static int floor(final float f) {
|
||||
return (int) Math.floor(f);
|
||||
}
|
||||
|
||||
public static float max(final float a, final float b) {
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
public static float max(final float a, final float b, final float c) {
|
||||
return Math.max(Math.max(a, b), c);
|
||||
}
|
||||
|
||||
public static float max(final float a, final float b, final float c, final float d) {
|
||||
return Math.max(Math.max(Math.max(a, b), c), d);
|
||||
}
|
||||
|
||||
public static int max(final int a, final int b) {
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
public static long max(final long a, final long b) {
|
||||
return Math.max(a, b);
|
||||
}
|
||||
|
||||
public static Vector3f max(final Vector3f a, final Vector3f b) {
|
||||
return new Vector3f(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z));
|
||||
}
|
||||
|
||||
public static float min(final float a, final float b) {
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
public static float min(final float a, final float b, final float c) {
|
||||
return Math.min(Math.min(a, b), c);
|
||||
}
|
||||
|
||||
public static float min(final float a, final float b, final float c, final float d) {
|
||||
return Math.min(Math.min(Math.min(a, b), c), d);
|
||||
}
|
||||
|
||||
public static int min(final int a, final int b) {
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
public static long min(final long a, final long b) {
|
||||
return Math.min(a, b);
|
||||
}
|
||||
|
||||
public static Vector3f min(final Vector3f a, final Vector3f b) {
|
||||
return new Vector3f(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z));
|
||||
}
|
||||
|
||||
public static float mod(final float value, final float modulo) {
|
||||
// TODO Auto-generated method stub
|
||||
return value % modulo;
|
||||
}
|
||||
|
||||
public static float pow(final float value, final float exponent) {
|
||||
// TODO Auto-generated method stub
|
||||
return (float) Math.pow(value, exponent);
|
||||
}
|
||||
|
||||
/// Return true if two values have the same sign
|
||||
public static boolean sameSign(final float a, final float b) {
|
||||
return a * b >= 0.0f;
|
||||
}
|
||||
|
||||
public static float sqrt(final float value) {
|
||||
return (float) Math.sqrt(value);
|
||||
}
|
||||
}
|
@ -79,17 +79,18 @@ public class Matrix3f {
|
||||
* @param c2 element 2x1
|
||||
* @param c3 element 2x2
|
||||
*/
|
||||
public void set(float a1, float a2, float a3,
|
||||
public Matrix3f set(float a1, float a2, float a3,
|
||||
float b1, float b2, float b3,
|
||||
float c1, float c2, float c3) {
|
||||
this.mat[0] = a1; this.mat[1] = a2; this.mat[2] = a3;
|
||||
this.mat[3] = b1; this.mat[4] = b2; this.mat[5] = b3;
|
||||
this.mat[6] = c1; this.mat[7] = c2; this.mat[8] = c3;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief Load Zero matrix
|
||||
*/
|
||||
public void setZero() {
|
||||
public Matrix3f setZero() {
|
||||
this.mat[0] = 0.0f;
|
||||
this.mat[1] = 0.0f;
|
||||
this.mat[2] = 0.0f;
|
||||
@ -99,6 +100,7 @@ public class Matrix3f {
|
||||
this.mat[6] = 0.0f;
|
||||
this.mat[7] = 0.0f;
|
||||
this.mat[8] = 0.0f;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +108,7 @@ public class Matrix3f {
|
||||
* @param iii Id of the colomn
|
||||
* @return Vector 3D vith the values
|
||||
*/
|
||||
Vector3f getColumn(int iii) {
|
||||
public Vector3f getColumn(int iii) {
|
||||
if (iii == 0) {
|
||||
return new Vector3f(this.mat[0], this.mat[3], this.mat[6]);
|
||||
} else if (iii == 1) {
|
||||
@ -134,16 +136,16 @@ public class Matrix3f {
|
||||
* @brief get a transpose matrix of this one.
|
||||
* @return the transpose matrix
|
||||
*/
|
||||
public Matrix3f getTranspose() {
|
||||
public Matrix3f transposeNew() {
|
||||
return new Matrix3f(this.mat[0], this.mat[3], this.mat[6],
|
||||
this.mat[1], this.mat[4], this.mat[7],
|
||||
this.mat[2], this.mat[5], this.mat[8]);
|
||||
this.mat[1], this.mat[4], this.mat[7],
|
||||
this.mat[2], this.mat[5], this.mat[8]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transpose the current matrix.
|
||||
*/
|
||||
public void transpose() {
|
||||
public Matrix3f transpose() {
|
||||
float tmp = this.mat[1];
|
||||
this.mat[1] = this.mat[3];
|
||||
this.mat[3] = tmp;
|
||||
@ -153,6 +155,7 @@ public class Matrix3f {
|
||||
tmp = this.mat[5];
|
||||
this.mat[5] = this.mat[7];
|
||||
this.mat[7] = tmp;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief Computes the determinant of the matrix.
|
||||
@ -171,7 +174,7 @@ public class Matrix3f {
|
||||
return (this.mat[0] + this.mat[4] + this.mat[8]);
|
||||
}
|
||||
/**
|
||||
* @brief Inverts the matrix.
|
||||
* @brief Inverse the matrix.
|
||||
* @note The determinant must be != 0, otherwithe the matrix can't be inverted.
|
||||
* @return The inverted matrix.
|
||||
*/
|
||||
@ -190,17 +193,30 @@ public class Matrix3f {
|
||||
//assert(Math.abs(det) > MACHINEEPSILON);
|
||||
float invDet = 1.0f / det;
|
||||
this.set( (this.mat[4] * this.mat[8]-this.mat[7] * this.mat[5]),
|
||||
-(this.mat[1] * this.mat[8]-this.mat[7] * this.mat[2]),
|
||||
(this.mat[1] * this.mat[5]-this.mat[2] * this.mat[4]),
|
||||
-(this.mat[3] * this.mat[8]-this.mat[6] * this.mat[5]),
|
||||
(this.mat[0] * this.mat[8]-this.mat[6] * this.mat[2]),
|
||||
-(this.mat[0] * this.mat[5]-this.mat[3] * this.mat[2]),
|
||||
(this.mat[3] * this.mat[7]-this.mat[6] * this.mat[4]),
|
||||
-(this.mat[0] * this.mat[7]-this.mat[6] * this.mat[1]),
|
||||
(this.mat[0] * this.mat[4]-this.mat[1] * this.mat[3]));
|
||||
-(this.mat[1] * this.mat[8]-this.mat[7] * this.mat[2]),
|
||||
(this.mat[1] * this.mat[5]-this.mat[2] * this.mat[4]),
|
||||
-(this.mat[3] * this.mat[8]-this.mat[6] * this.mat[5]),
|
||||
(this.mat[0] * this.mat[8]-this.mat[6] * this.mat[2]),
|
||||
-(this.mat[0] * this.mat[5]-this.mat[3] * this.mat[2]),
|
||||
(this.mat[3] * this.mat[7]-this.mat[6] * this.mat[4]),
|
||||
-(this.mat[0] * this.mat[7]-this.mat[6] * this.mat[1]),
|
||||
(this.mat[0] * this.mat[4]-this.mat[1] * this.mat[3]));
|
||||
this.multiply(invDet);
|
||||
return this;
|
||||
}
|
||||
// Overloaded operator for the negative of the matrix
|
||||
public Matrix3f invert() {
|
||||
this.mat[0] = -this.mat[0];
|
||||
this.mat[1] = -this.mat[1];
|
||||
this.mat[2] = -this.mat[2];
|
||||
this.mat[3] = -this.mat[3];
|
||||
this.mat[4] = -this.mat[4];
|
||||
this.mat[5] = -this.mat[5];
|
||||
this.mat[6] = -this.mat[6];
|
||||
this.mat[7] = -this.mat[7];
|
||||
this.mat[8] = -this.mat[8];
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief get the matrix with the absolute value
|
||||
* @return matix in absolute
|
||||
@ -213,6 +229,19 @@ public class Matrix3f {
|
||||
/**
|
||||
* @brief absolutise the matrix
|
||||
*/
|
||||
public Matrix3f abs(){
|
||||
this.mat[0] = Math.abs(this.mat[0]);
|
||||
this.mat[1] = Math.abs(this.mat[1]);
|
||||
this.mat[2] = Math.abs(this.mat[2]);
|
||||
this.mat[3] = Math.abs(this.mat[3]);
|
||||
this.mat[4] = Math.abs(this.mat[4]);
|
||||
this.mat[5] = Math.abs(this.mat[5]);
|
||||
this.mat[6] = Math.abs(this.mat[6]);
|
||||
this.mat[7] = Math.abs(this.mat[7]);
|
||||
this.mat[8] = Math.abs(this.mat[8]);
|
||||
return this;
|
||||
}
|
||||
@Deprecated
|
||||
public void absolute(){
|
||||
this.mat[0] = Math.abs(this.mat[0]);
|
||||
this.mat[1] = Math.abs(this.mat[1]);
|
||||
@ -227,10 +256,11 @@ public class Matrix3f {
|
||||
/**
|
||||
* @brief Load Identity matrix
|
||||
*/
|
||||
public void setIdentity(){
|
||||
public Matrix3f setIdentity(){
|
||||
this.mat[0] = 1.0f; this.mat[1] = 0.0f; this.mat[2] = 0.0f;
|
||||
this.mat[3] = 0.0f; this.mat[4] = 1.0f; this.mat[5] = 0.0f;
|
||||
this.mat[6] = 0.0f; this.mat[7] = 0.0f; this.mat[8] = 1.0f;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief create a Identity matrix
|
||||
@ -360,6 +390,22 @@ public class Matrix3f {
|
||||
this.mat[7] = c2;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief Operator*= Multiplication an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
* @return Local reference of the vector multiplicated
|
||||
*/
|
||||
public void multiplyTo(Matrix3f obj, Matrix3f out) {
|
||||
out.mat[2] = this.mat[0]*obj.mat[2] + this.mat[1]*obj.mat[5] + this.mat[2]*obj.mat[8];
|
||||
out.mat[5] = this.mat[3]*obj.mat[2] + this.mat[4]*obj.mat[5] + this.mat[5]*obj.mat[8];
|
||||
out.mat[8] = this.mat[6]*obj.mat[2] + this.mat[7]*obj.mat[5] + this.mat[8]*obj.mat[8];
|
||||
out.mat[0] = this.mat[0]*obj.mat[0] + this.mat[1]*obj.mat[3] + this.mat[2]*obj.mat[6];
|
||||
out.mat[3] = this.mat[3]*obj.mat[0] + this.mat[4]*obj.mat[3] + this.mat[5]*obj.mat[6];
|
||||
out.mat[6] = this.mat[6]*obj.mat[0] + this.mat[7]*obj.mat[3] + this.mat[8]*obj.mat[6];
|
||||
out.mat[1] = this.mat[0]*obj.mat[1] + this.mat[1]*obj.mat[4] + this.mat[2]*obj.mat[7];
|
||||
out.mat[4] = this.mat[3]*obj.mat[1] + this.mat[4]*obj.mat[4] + this.mat[5]*obj.mat[7];
|
||||
out.mat[7] = this.mat[6]*obj.mat[1] + this.mat[7]*obj.mat[4] + this.mat[8]*obj.mat[7];
|
||||
}
|
||||
/**
|
||||
* @brief Operator* Multiplication an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
@ -402,11 +448,16 @@ public class Matrix3f {
|
||||
* @param point Point value to apply the matrix
|
||||
* @return New vector containing the value
|
||||
*/
|
||||
public Vector3f multiply(Vector3f point) {
|
||||
public Vector3f multiplyNew(Vector3f point) {
|
||||
return new Vector3f(point.x * this.mat[0] + point.y * this.mat[1] + point.z * this.mat[2],
|
||||
point.x * this.mat[3] + point.y * this.mat[4] + point.z * this.mat[5],
|
||||
point.x * this.mat[6] + point.y * this.mat[7] + point.z * this.mat[8]);
|
||||
}
|
||||
public void multiplyTo(Vector3f point, Vector3f out) {
|
||||
out.set(point.x * this.mat[0] + point.y * this.mat[1] + point.z * this.mat[2],
|
||||
point.x * this.mat[3] + point.y * this.mat[4] + point.z * this.mat[5],
|
||||
point.x * this.mat[6] + point.y * this.mat[7] + point.z * this.mat[8]);
|
||||
}
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple rotation
|
||||
* @param normal vector aroud witch apply the rotation
|
||||
@ -432,4 +483,41 @@ public class Matrix3f {
|
||||
tmp.mat[8] = normal.z * normal.z * invVal + cosVal;
|
||||
return tmp;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 1542;
|
||||
hash += Float.floatToIntBits(this.mat[0]);
|
||||
hash += Float.floatToIntBits(this.mat[1]);
|
||||
hash += Float.floatToIntBits(this.mat[2]);
|
||||
hash += Float.floatToIntBits(this.mat[3]);
|
||||
hash += Float.floatToIntBits(this.mat[4]);
|
||||
hash += Float.floatToIntBits(this.mat[5]);
|
||||
hash += Float.floatToIntBits(this.mat[6]);
|
||||
hash += Float.floatToIntBits(this.mat[7]);
|
||||
hash += Float.floatToIntBits(this.mat[8]);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Matrix3f other = (Matrix3f) obj;
|
||||
for(int iii=0; iii<3*3 ; ++iii) {
|
||||
if (Float.floatToIntBits(this.mat[iii]) != Float.floatToIntBits(other.mat[iii])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return a skew-symmetric matrix using a given vector that can be used
|
||||
// to compute cross product with another vector using matrix multiplication
|
||||
public Matrix3f computeSkewSymmetricMatrixForCrossProductNew(Vector3f vector) {
|
||||
return new Matrix3f(0.0f, -vector.z, vector.y, vector.z, 0, -vector.x, -vector.y, vector.x, 0.0f);
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,190 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
public class Matrix4f {
|
||||
public float[] mat = new float[4*4]; //!< matrix data
|
||||
/**
|
||||
* @brief configure identity of the matrix
|
||||
*/
|
||||
public void setIdentity() {
|
||||
for(int iii=0; iii<4*4 ; iii++) {
|
||||
this.mat[iii] = 0;
|
||||
* @brief Create projection matrix with the box parameter (camera view in -z axis)
|
||||
* @param xmin X minimum size of the frustum
|
||||
* @param xmax X maximum size of the frustum
|
||||
* @param ymin Y minimum size of the frustum
|
||||
* @param ymax Y maximum size of the frustum
|
||||
* @param zNear Z minimum size of the frustum
|
||||
* @param zFar Z maximum size of the frustum
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixFrustum(final float xmin, final float xmax, final float ymin, final float ymax, final float zNear, final float zFar) {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
for (int iii = 0; iii < 4 * 4; iii++) {
|
||||
tmp.mat[iii] = 0;
|
||||
}
|
||||
this.mat[0] = 1.0f;
|
||||
this.mat[5] = 1.0f;
|
||||
this.mat[10] = 1.0f;
|
||||
this.mat[15] = 1.0f;
|
||||
// 0 1 2 3
|
||||
// 4 5 6 7
|
||||
// 8 9 10 11
|
||||
// 12 13 14 15
|
||||
tmp.mat[0] = (2.0f * zNear) / (xmax - xmin);
|
||||
tmp.mat[5] = (2.0f * zNear) / (ymax - ymin);
|
||||
tmp.mat[10] = -(zFar + zNear) / (zFar - zNear);
|
||||
tmp.mat[2] = (xmax + xmin) / (xmax - xmin);
|
||||
tmp.mat[6] = (ymax + ymin) / (ymax - ymin);
|
||||
tmp.mat[14] = -1.0f;
|
||||
tmp.mat[11] = -(2.0f * zFar * zNear) / (zFar - zNear);
|
||||
return tmp;
|
||||
}
|
||||
public static Matrix4f identity() {
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
|
||||
/**
|
||||
* @brief Create projection matrix with camera property (camera view in -z axis)
|
||||
* @param eye Optical center of the camera
|
||||
* @param target Point of where the camera is showing
|
||||
* @param up Up vector of the camera
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixLookAt(final Vector3f eye, final Vector3f target, final Vector3f up) {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
|
||||
final Vector3f forward = eye;
|
||||
forward.less(target);
|
||||
forward.safeNormalize();
|
||||
final Vector3f xaxis = target.cross(up.normalizeNew());
|
||||
xaxis.safeNormalize();
|
||||
final Vector3f up2 = xaxis.cross(forward);
|
||||
xaxis.safeNormalize();
|
||||
|
||||
tmp.mat[0] = xaxis.x;
|
||||
tmp.mat[1] = up2.x;
|
||||
tmp.mat[2] = forward.x;
|
||||
tmp.mat[3] = eye.x;
|
||||
|
||||
tmp.mat[4] = xaxis.y;
|
||||
tmp.mat[5] = up2.y;
|
||||
tmp.mat[6] = forward.y;
|
||||
tmp.mat[7] = eye.y;
|
||||
|
||||
tmp.mat[8] = xaxis.z;
|
||||
tmp.mat[9] = up2.z;
|
||||
tmp.mat[10] = forward.z;
|
||||
tmp.mat[11] = eye.z;
|
||||
|
||||
tmp.mat[12] = 0.0f;
|
||||
tmp.mat[13] = 0.0f;
|
||||
tmp.mat[14] = 0.0f;
|
||||
tmp.mat[15] = 1.0f;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create orthogonal projection matrix with the box parameter (camera view in -z axis)
|
||||
* @param left left size of the camera
|
||||
* @param right Right size of the camera
|
||||
* @param bottom Buttom size of the camera
|
||||
* @param top Top Size of the camera
|
||||
* @param nearVal Z near size of the camera
|
||||
* @param farVal Z far size of the camera
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixOrtho(final float left, final float right, final float bottom, final float top, final float nearVal, final float farVal) {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
for (int iii = 0; iii < 4 * 4; iii++) {
|
||||
tmp.mat[iii] = 0;
|
||||
}
|
||||
tmp.mat[0] = 2.0f / (right - left);
|
||||
tmp.mat[5] = 2.0f / (top - bottom);
|
||||
tmp.mat[10] = -2.0f / (farVal - nearVal);
|
||||
tmp.mat[3] = -1 * (right + left) / (right - left);
|
||||
tmp.mat[7] = -1 * (top + bottom) / (top - bottom);
|
||||
tmp.mat[11] = -1 * (farVal + nearVal) / (farVal - nearVal);
|
||||
tmp.mat[15] = 1;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create projection matrix with human repensentation view (camera view in -z axis)
|
||||
* @param foxy Focal in radian of the camera
|
||||
* @param aspect aspect ratio of the camera
|
||||
* @param zNear Z near size of the camera
|
||||
* @param zFar Z far size of the camera
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixPerspective(final float foxy, final float aspect, final float zNear, final float zFar) {
|
||||
//TKDEBUG("drax perspective: foxy=" << foxy << "->" << aspect << " " << zNear << "->" << zFar);
|
||||
final float xmax = zNear * (float) Math.tan(foxy / 2.0);
|
||||
final float xmin = -xmax;
|
||||
|
||||
final float ymin = xmin / aspect;
|
||||
final float ymax = xmax / aspect;
|
||||
//TKDEBUG("drax perspective: " << xmin << "->" << xmax << " & " << ymin << "->" << ymax << " " << zNear << "->" << zFar);
|
||||
return createMatrixFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple rotation
|
||||
* @param normal vector aroud witch apply the rotation
|
||||
* @param angleRad Radian angle to set at the matrix
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixRotate(final Vector3f normal, final float angleRad) {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
final float cosVal = (float) Math.cos(angleRad);
|
||||
final float sinVal = (float) Math.sin(angleRad);
|
||||
final float invVal = 1.0f - cosVal;
|
||||
// set rotation :
|
||||
tmp.mat[0] = normal.x * normal.x * invVal + cosVal;
|
||||
tmp.mat[1] = normal.x * normal.y * invVal - normal.z * sinVal;
|
||||
tmp.mat[2] = normal.x * normal.z * invVal + normal.y * sinVal;
|
||||
|
||||
tmp.mat[4] = normal.y * normal.x * invVal + normal.z * sinVal;
|
||||
tmp.mat[5] = normal.y * normal.y * invVal + cosVal;
|
||||
tmp.mat[6] = normal.y * normal.z * invVal - normal.x * sinVal;
|
||||
|
||||
tmp.mat[8] = normal.z * normal.x * invVal - normal.y * sinVal;
|
||||
tmp.mat[9] = normal.z * normal.y * invVal + normal.x * sinVal;
|
||||
tmp.mat[10] = normal.z * normal.z * invVal + cosVal;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//! @notindoc
|
||||
public static Matrix4f createMatrixRotate2(final Vector3f vect) {
|
||||
return createMatrixLookAt(vect, new Vector3f(0, 0, 0), new Vector3f(0, 1, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple scale
|
||||
* @param scale 3 dimention scale
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixScale(final Vector3f scale) {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
tmp.scale(scale);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple translation
|
||||
* @param translate 3 dimention translation
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixTranslate(final Vector3f translate) {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
// set translation :
|
||||
tmp.mat[3] = translate.x;
|
||||
tmp.mat[7] = translate.y;
|
||||
tmp.mat[11] = translate.z;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static Matrix4f identity() {
|
||||
final Matrix4f tmp = new Matrix4f();
|
||||
tmp.setIdentity();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public float[] mat = new float[4 * 4]; //!< matrix data
|
||||
|
||||
/**
|
||||
* @brief Constructor that load identity
|
||||
*/
|
||||
public Matrix4f() {
|
||||
setIdentity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configuration constructor.
|
||||
* @param a1 1st colomn, 1 line value
|
||||
@ -44,10 +204,8 @@ public class Matrix4f {
|
||||
* @param c4 3rd colomn, 4 line value
|
||||
* @param d4 4th colomn, 4 line value
|
||||
*/
|
||||
public Matrix4f(float a1, float b1, float c1, float d1,
|
||||
float a2, float b2, float c2, float d2,
|
||||
float a3, float b3, float c3, float d3,
|
||||
float a4, float b4, float c4, float d4) {
|
||||
public Matrix4f(final float a1, final float b1, final float c1, final float d1, final float a2, final float b2, final float c2, final float d2, final float a3, final float b3, final float c3,
|
||||
final float d3, final float a4, final float b4, final float c4, final float d4) {
|
||||
this.mat[0] = a1;
|
||||
this.mat[1] = b1;
|
||||
this.mat[2] = c1;
|
||||
@ -65,20 +223,22 @@ public class Matrix4f {
|
||||
this.mat[14] = c4;
|
||||
this.mat[15] = d4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configuration constructor.
|
||||
* @param values vector of values
|
||||
*/
|
||||
public Matrix4f(float[] values) {
|
||||
public Matrix4f(final float[] values) {
|
||||
if (values == null) {
|
||||
setIdentity();
|
||||
return;
|
||||
}
|
||||
for(int iii=0; iii<16 ; ++iii) {
|
||||
for (int iii = 0; iii < 16; ++iii) {
|
||||
this.mat[iii] = values[iii];
|
||||
}
|
||||
}
|
||||
public Matrix4f(Matrix3f matrix) {
|
||||
|
||||
public Matrix4f(final Matrix3f matrix) {
|
||||
this.mat[0] = matrix.mat[0];
|
||||
this.mat[1] = matrix.mat[1];
|
||||
this.mat[2] = matrix.mat[2];
|
||||
@ -95,113 +255,286 @@ public class Matrix4f {
|
||||
this.mat[13] = 0;
|
||||
this.mat[14] = 0;
|
||||
this.mat[15] = 1;
|
||||
// this.mat[0] = matrix.mat[0];
|
||||
// this.mat[1] = matrix.mat[3];
|
||||
// this.mat[2] = matrix.mat[6];
|
||||
// this.mat[3] = 0;
|
||||
// this.mat[4] = matrix.mat[1];
|
||||
// this.mat[5] = matrix.mat[4];
|
||||
// this.mat[6] = matrix.mat[7];
|
||||
// this.mat[7] = 0;
|
||||
// this.mat[8] = matrix.mat[2];
|
||||
// this.mat[9] = matrix.mat[5];
|
||||
// this.mat[10] = matrix.mat[8];
|
||||
// this.mat[11] = 0;
|
||||
// this.mat[12] = 0;
|
||||
// this.mat[13] = 0;
|
||||
// this.mat[14] = 0;
|
||||
// this.mat[15] = 1;
|
||||
// this.mat[0] = matrix.mat[0];
|
||||
// this.mat[1] = matrix.mat[3];
|
||||
// this.mat[2] = matrix.mat[6];
|
||||
// this.mat[3] = 0;
|
||||
// this.mat[4] = matrix.mat[1];
|
||||
// this.mat[5] = matrix.mat[4];
|
||||
// this.mat[6] = matrix.mat[7];
|
||||
// this.mat[7] = 0;
|
||||
// this.mat[8] = matrix.mat[2];
|
||||
// this.mat[9] = matrix.mat[5];
|
||||
// this.mat[10] = matrix.mat[8];
|
||||
// this.mat[11] = 0;
|
||||
// this.mat[12] = 0;
|
||||
// this.mat[13] = 0;
|
||||
// this.mat[14] = 0;
|
||||
// this.mat[15] = 1;
|
||||
}
|
||||
|
||||
// copy contructor:
|
||||
public Matrix4f(final Matrix4f matrix) {
|
||||
for (int iii = 0; iii < 16; ++iii) {
|
||||
this.mat[iii] = matrix.mat[iii];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator+= Addition an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void add(final Matrix4f obj) {
|
||||
for (int iii = 0; iii < 4 * 4; ++iii) {
|
||||
this.mat[iii] += obj.mat[iii];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator= Asign the current object with an other object
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void set(Matrix4f obj) {
|
||||
for(int iii=0; iii<16 ; iii++) {
|
||||
this.mat[iii] = obj.mat[iii];
|
||||
}
|
||||
@Override
|
||||
public Matrix4f clone() {
|
||||
return new Matrix4f(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are identical
|
||||
* @return false The Objects are NOT identical
|
||||
* @brief Computes a cofactor. Used for matrix inversion.
|
||||
* @param row Id of raw.
|
||||
* @param col Id of colomn.
|
||||
* @return the coFactorValue.
|
||||
*/
|
||||
public boolean isEqual(Matrix4f obj) {
|
||||
for(int iii=0; iii<4*4 ; ++iii) {
|
||||
if(this.mat[iii] != obj.mat[iii]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
public float coFactor(final int row, final int col) {
|
||||
return ((this.mat[((row + 1) & 3) * 4 + ((col + 1) & 3)] * this.mat[((row + 2) & 3) * 4 + ((col + 2) & 3)] * this.mat[((row + 3) & 3) * 4 + ((col + 3) & 3)]
|
||||
+ this.mat[((row + 1) & 3) * 4 + ((col + 2) & 3)] * this.mat[((row + 2) & 3) * 4 + ((col + 3) & 3)] * this.mat[((row + 3) & 3) * 4 + ((col + 1) & 3)]
|
||||
+ this.mat[((row + 1) & 3) * 4 + ((col + 3) & 3)] * this.mat[((row + 2) & 3) * 4 + ((col + 1) & 3)] * this.mat[((row + 3) & 3) * 4 + ((col + 2) & 3)])
|
||||
- (this.mat[((row + 3) & 3) * 4 + ((col + 1) & 3)] * this.mat[((row + 2) & 3) * 4 + ((col + 2) & 3)] * this.mat[((row + 1) & 3) * 4 + ((col + 3) & 3)]
|
||||
+ this.mat[((row + 3) & 3) * 4 + ((col + 2) & 3)] * this.mat[((row + 2) & 3) * 4 + ((col + 3) & 3)] * this.mat[((row + 1) & 3) * 4 + ((col + 1) & 3)]
|
||||
+ this.mat[((row + 3) & 3) * 4 + ((col + 3) & 3)] * this.mat[((row + 2) & 3) * 4 + ((col + 1) & 3)] * this.mat[((row + 1) & 3) * 4 + ((col + 2) & 3)]))
|
||||
* (((row + col) & 1) == 1 ? -1.0f : +1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator-= Decrement an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void decrement(final Matrix4f obj) {
|
||||
for (int iii = 0; iii < 4 * 4; ++iii) {
|
||||
this.mat[iii] -= obj.mat[iii];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Computes the determinant of the matrix.
|
||||
* @return The determinent Value.
|
||||
*/
|
||||
public float determinant() {
|
||||
return this.mat[0] * coFactor(0, 0) + this.mat[1] * coFactor(0, 1) + this.mat[2] * coFactor(0, 2) + this.mat[3] * coFactor(0, 3);
|
||||
}
|
||||
|
||||
public float[] getTable() {
|
||||
return this.mat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inverts the matrix.
|
||||
* @note The determinant must be != 0, otherwithe the matrix can't be inverted.
|
||||
* @return The inverted matrix.
|
||||
*/
|
||||
public Matrix4f invertNew() {
|
||||
final float det = determinant();
|
||||
if (Math.abs(det) < (1.0e-7f)) {
|
||||
// The matrix is not invertible! Singular case!
|
||||
return clone();
|
||||
}
|
||||
final Matrix4f temp = new Matrix4f();
|
||||
final float iDet = 1.0f / det;
|
||||
temp.mat[0] = coFactor(0, 0) * iDet;
|
||||
temp.mat[1] = coFactor(0, 1) * iDet;
|
||||
temp.mat[2] = coFactor(0, 2) * iDet;
|
||||
temp.mat[3] = coFactor(0, 3) * iDet;
|
||||
temp.mat[4] = coFactor(1, 0) * iDet;
|
||||
temp.mat[5] = coFactor(1, 1) * iDet;
|
||||
temp.mat[6] = coFactor(1, 2) * iDet;
|
||||
temp.mat[7] = coFactor(1, 3) * iDet;
|
||||
temp.mat[8] = coFactor(2, 0) * iDet;
|
||||
temp.mat[9] = coFactor(2, 1) * iDet;
|
||||
temp.mat[10] = coFactor(2, 2) * iDet;
|
||||
temp.mat[11] = coFactor(2, 3) * iDet;
|
||||
temp.mat[12] = coFactor(3, 0) * iDet;
|
||||
temp.mat[13] = coFactor(3, 1) * iDet;
|
||||
temp.mat[14] = coFactor(3, 2) * iDet;
|
||||
temp.mat[15] = coFactor(3, 3) * iDet;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief In-Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are NOT identical
|
||||
* @return false The Objects are identical
|
||||
*/
|
||||
public boolean isDifferent(Matrix4f obj) {
|
||||
for(int iii=0; iii<4*4 ; ++iii) {
|
||||
if(this.mat[iii] != obj.mat[iii]) {
|
||||
public boolean isDifferent(final Matrix4f obj) {
|
||||
for (int iii = 0; iii < 4 * 4; ++iii) {
|
||||
if (this.mat[iii] != obj.mat[iii]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator+= Addition an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
* @brief Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are identical
|
||||
* @return false The Objects are NOT identical
|
||||
*/
|
||||
public void add(Matrix4f obj) {
|
||||
for(int iii=0; iii<4*4 ; ++iii) {
|
||||
this.mat[iii] += obj.mat[iii];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief Operator-= Decrement an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void decrement(Matrix4f obj) {
|
||||
for(int iii=0; iii<4*4 ; ++iii) {
|
||||
this.mat[iii] -= obj.mat[iii];
|
||||
public boolean isEqual(final Matrix4f obj) {
|
||||
for (int iii = 0; iii < 4 * 4; ++iii) {
|
||||
if (this.mat[iii] != obj.mat[iii]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator*= Multiplication an other matrix with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public Matrix4f multiply(Matrix4f obj) {
|
||||
public Matrix4f multiply(final Matrix4f obj) {
|
||||
// output Matrix
|
||||
float[] matrixOut = new float[16];
|
||||
for(int xxx=0; xxx<4 ; xxx++) {
|
||||
for(int yyy=0; yyy<4 ; yyy++) {
|
||||
final float[] matrixOut = new float[16];
|
||||
for (int xxx = 0; xxx < 4; xxx++) {
|
||||
for (int yyy = 0; yyy < 4; yyy++) {
|
||||
float value = 0;
|
||||
for(int kkk=0; kkk<4 ; kkk++) {
|
||||
value += this.mat[yyy*4+kkk] * obj.mat[kkk*4+xxx];
|
||||
for (int kkk = 0; kkk < 4; kkk++) {
|
||||
value += this.mat[yyy * 4 + kkk] * obj.mat[kkk * 4 + xxx];
|
||||
}
|
||||
matrixOut[yyy*4+xxx] = value;
|
||||
matrixOut[yyy * 4 + xxx] = value;
|
||||
}
|
||||
}
|
||||
// set it at the output
|
||||
for(int iii=0; iii<4*4 ; iii++) {
|
||||
for (int iii = 0; iii < 4 * 4; iii++) {
|
||||
this.mat[iii] = matrixOut[iii];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public Matrix4f multiplyNew(Matrix4f obj) {
|
||||
return this.clone().multiply(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator* apply matrix on a vector
|
||||
* @param point Point value to apply the matrix
|
||||
* @return New vector containing the value
|
||||
*/
|
||||
public Vector3f multiply(Vector3f point) {
|
||||
return new Vector3f( this.mat[0]*point.x + this.mat[1]*point.y + this.mat[2]*point.z + this.mat[3],
|
||||
this.mat[4]*point.x + this.mat[5]*point.y + this.mat[6]*point.z + this.mat[7],
|
||||
this.mat[8]*point.x + this.mat[9]*point.y + this.mat[10]*point.z + this.mat[11] );
|
||||
public Vector3f multiply(final Vector3f point) {
|
||||
return new Vector3f(this.mat[0] * point.x + this.mat[1] * point.y + this.mat[2] * point.z + this.mat[3], this.mat[4] * point.x + this.mat[5] * point.y + this.mat[6] * point.z + this.mat[7],
|
||||
this.mat[8] * point.x + this.mat[9] * point.y + this.mat[10] * point.z + this.mat[11]);
|
||||
}
|
||||
|
||||
public Matrix4f multiplyNew(final Matrix4f obj) {
|
||||
return clone().multiply(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Makes a rotation matrix about an arbitrary axis.
|
||||
* @param vect vector to apply the angle.
|
||||
* @param angleRad angle to apply.
|
||||
*/
|
||||
public Matrix4f rotate(final Vector3f vect, final float angleRad) {
|
||||
final Matrix4f tmpMat = createMatrixRotate(vect, angleRad);
|
||||
return this.multiply(tmpMat);
|
||||
}
|
||||
|
||||
public Matrix4f rotateNew(final Vector3f vect, final float angleRad) {
|
||||
final Matrix4f tmpMat = createMatrixRotate(vect, angleRad);
|
||||
return multiplyNew(tmpMat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Scale the current Matrix in all direction with 1 value.
|
||||
* @param scale Scale XYZ value to apply.
|
||||
*/
|
||||
public Matrix4f scale(final float scale) {
|
||||
return scale(scale, scale, scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Scale the current Matrix.
|
||||
* @param sx Scale X value to apply.
|
||||
* @param sy Scale Y value to apply.
|
||||
* @param sz Scale Z value to apply.
|
||||
*/
|
||||
public Matrix4f scale(final float sx, final float sy, final float sz) {
|
||||
this.mat[0] *= sx;
|
||||
this.mat[1] *= sy;
|
||||
this.mat[2] *= sz;
|
||||
this.mat[4] *= sx;
|
||||
this.mat[5] *= sy;
|
||||
this.mat[6] *= sz;
|
||||
this.mat[8] *= sx;
|
||||
this.mat[9] *= sy;
|
||||
this.mat[10] *= sz;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Scale the current Matrix.
|
||||
* @param vect Scale vector to apply.
|
||||
*/
|
||||
public Matrix4f scale(final Vector3f vect) {
|
||||
return scale(vect.x, vect.y, vect.z);
|
||||
}
|
||||
|
||||
public Matrix4f scaleNew(final float scale) {
|
||||
return clone().scale(scale, scale, scale);
|
||||
}
|
||||
|
||||
public Matrix4f scaleNew(final float sx, final float sy, final float sz) {
|
||||
return clone().scale(sx, sy, sz);
|
||||
}
|
||||
|
||||
public Matrix4f scaleNew(final Vector3f vect) {
|
||||
return clone().scale(vect.x, vect.y, vect.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator= Asign the current object with an other object
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void set(final Matrix4f obj) {
|
||||
for (int iii = 0; iii < 16; iii++) {
|
||||
this.mat[iii] = obj.mat[iii];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief configure identity of the matrix
|
||||
*/
|
||||
public void setIdentity() {
|
||||
for (int iii = 0; iii < 4 * 4; iii++) {
|
||||
this.mat[iii] = 0;
|
||||
}
|
||||
this.mat[0] = 1.0f;
|
||||
this.mat[5] = 1.0f;
|
||||
this.mat[10] = 1.0f;
|
||||
this.mat[15] = 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Makes a translation of the matrix
|
||||
* @param vect Translation to apply.
|
||||
*/
|
||||
public Matrix4f translate(final Vector3f vect) {
|
||||
final Matrix4f tmpMat = createMatrixTranslate(vect);
|
||||
return this.multiply(tmpMat);
|
||||
}
|
||||
|
||||
public Matrix4f translateNew(final Vector3f vect) {
|
||||
final Matrix4f tmpMat = createMatrixTranslate(vect);
|
||||
return multiplyNew(tmpMat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transpose the current matix (usefull for OpenGL display)
|
||||
*/
|
||||
@ -231,308 +564,9 @@ public class Matrix4f {
|
||||
this.mat[14] = tmpVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Matrix4f transposeNew() {
|
||||
return this.clone().transpose();
|
||||
}
|
||||
/**
|
||||
* @brief Scale the current Matrix.
|
||||
* @param vect Scale vector to apply.
|
||||
*/
|
||||
public Matrix4f scale(Vector3f vect) {
|
||||
return scale(vect.x, vect.y, vect.z);
|
||||
}
|
||||
public Matrix4f scaleNew(Vector3f vect) {
|
||||
return this.clone().scale(vect.x, vect.y, vect.z);
|
||||
}
|
||||
/**
|
||||
* @brief Scale the current Matrix.
|
||||
* @param sx Scale X value to apply.
|
||||
* @param sy Scale Y value to apply.
|
||||
* @param sz Scale Z value to apply.
|
||||
*/
|
||||
public Matrix4f scale(float sx, float sy, float sz) {
|
||||
this.mat[0] *= sx; this.mat[1] *= sy; this.mat[2] *= sz;
|
||||
this.mat[4] *= sx; this.mat[5] *= sy; this.mat[6] *= sz;
|
||||
this.mat[8] *= sx; this.mat[9] *= sy; this.mat[10] *= sz;
|
||||
return this;
|
||||
}
|
||||
public Matrix4f scaleNew(float sx, float sy, float sz) {
|
||||
return this.clone().scale(sx, sy, sz);
|
||||
}
|
||||
/**
|
||||
* @brief Scale the current Matrix in all direction with 1 value.
|
||||
* @param scale Scale XYZ value to apply.
|
||||
*/
|
||||
public Matrix4f scale(float scale) {
|
||||
return scale(scale, scale, scale);
|
||||
}
|
||||
public Matrix4f scaleNew(float scale) {
|
||||
return this.clone().scale(scale, scale, scale);
|
||||
}
|
||||
/**
|
||||
* @brief Makes a rotation matrix about an arbitrary axis.
|
||||
* @param vect vector to apply the angle.
|
||||
* @param angleRad angle to apply.
|
||||
*/
|
||||
public Matrix4f rotate(Vector3f vect, float angleRad) {
|
||||
Matrix4f tmpMat = createMatrixRotate(vect, angleRad);
|
||||
return this.multiply(tmpMat);
|
||||
}
|
||||
public Matrix4f rotateNew(Vector3f vect, float angleRad) {
|
||||
Matrix4f tmpMat = createMatrixRotate(vect, angleRad);
|
||||
return this.multiplyNew(tmpMat);
|
||||
}
|
||||
/**
|
||||
* @brief Makes a translation of the matrix
|
||||
* @param vect Translation to apply.
|
||||
*/
|
||||
public Matrix4f translate(Vector3f vect) {
|
||||
Matrix4f tmpMat = createMatrixTranslate(vect);
|
||||
return this.multiply(tmpMat);
|
||||
}
|
||||
public Matrix4f translateNew(Vector3f vect) {
|
||||
Matrix4f tmpMat = createMatrixTranslate(vect);
|
||||
return this.multiplyNew(tmpMat);
|
||||
}
|
||||
/**
|
||||
* @brief Computes a cofactor. Used for matrix inversion.
|
||||
* @param row Id of raw.
|
||||
* @param col Id of colomn.
|
||||
* @return the coFactorValue.
|
||||
*/
|
||||
public float coFactor(int row, int col) {
|
||||
return ( ( this.mat[((row+1)&3)*4 + ((col+1)&3)] * this.mat[((row+2)&3)*4 + ((col+2)&3)] * this.mat[((row+3)&3)*4 + ((col+3)&3)]
|
||||
+ this.mat[((row+1)&3)*4 + ((col+2)&3)] * this.mat[((row+2)&3)*4 + ((col+3)&3)] * this.mat[((row+3)&3)*4 + ((col+1)&3)]
|
||||
+ this.mat[((row+1)&3)*4 + ((col+3)&3)] * this.mat[((row+2)&3)*4 + ((col+1)&3)] * this.mat[((row+3)&3)*4 + ((col+2)&3)] )
|
||||
- ( this.mat[((row+3)&3)*4 + ((col+1)&3)] * this.mat[((row+2)&3)*4 + ((col+2)&3)] * this.mat[((row+1)&3)*4 + ((col+3)&3)]
|
||||
+ this.mat[((row+3)&3)*4 + ((col+2)&3)] * this.mat[((row+2)&3)*4 + ((col+3)&3)] * this.mat[((row+1)&3)*4 + ((col+1)&3)]
|
||||
+ this.mat[((row+3)&3)*4 + ((col+3)&3)] * this.mat[((row+2)&3)*4 + ((col+1)&3)] * this.mat[((row+1)&3)*4 + ((col+2)&3)] )
|
||||
) * (((row + col) & 1)== 1? -1.0f : +1.0f);
|
||||
}
|
||||
/**
|
||||
* @brief Computes the determinant of the matrix.
|
||||
* @return The determinent Value.
|
||||
*/
|
||||
public float determinant() {
|
||||
return this.mat[0] * coFactor(0, 0) +
|
||||
this.mat[1] * coFactor(0, 1) +
|
||||
this.mat[2] * coFactor(0, 2) +
|
||||
this.mat[3] * coFactor(0, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inverts the matrix.
|
||||
* @note The determinant must be != 0, otherwithe the matrix can't be inverted.
|
||||
* @return The inverted matrix.
|
||||
*/
|
||||
public Matrix4f invertNew() {
|
||||
float det = determinant();
|
||||
if(Math.abs(det) < (1.0e-7f)) {
|
||||
// The matrix is not invertible! Singular case!
|
||||
return clone();
|
||||
}
|
||||
Matrix4f temp = new Matrix4f();
|
||||
float iDet = 1.0f / det;
|
||||
temp.mat[0] = coFactor(0,0) * iDet;
|
||||
temp.mat[1] = coFactor(0,1) * iDet;
|
||||
temp.mat[2] = coFactor(0,2) * iDet;
|
||||
temp.mat[3] = coFactor(0,3) * iDet;
|
||||
temp.mat[4] = coFactor(1,0) * iDet;
|
||||
temp.mat[5] = coFactor(1,1) * iDet;
|
||||
temp.mat[6] = coFactor(1,2) * iDet;
|
||||
temp.mat[7] = coFactor(1,3) * iDet;
|
||||
temp.mat[8] = coFactor(2,0) * iDet;
|
||||
temp.mat[9] = coFactor(2,1) * iDet;
|
||||
temp.mat[10] = coFactor(2,2) * iDet;
|
||||
temp.mat[11] = coFactor(2,3) * iDet;
|
||||
temp.mat[12] = coFactor(3,0) * iDet;
|
||||
temp.mat[13] = coFactor(3,1) * iDet;
|
||||
temp.mat[14] = coFactor(3,2) * iDet;
|
||||
temp.mat[15] = coFactor(3,3) * iDet;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator= Asign the current object with an other object
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public Matrix4f clone() {
|
||||
Matrix4f out = new Matrix4f();
|
||||
for(int iii=0; iii<16 ; iii++) {
|
||||
out.mat[iii] = this.mat[iii];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create projection matrix with the box parameter (camera view in -z axis)
|
||||
* @param xmin X minimum size of the frustum
|
||||
* @param xmax X maximum size of the frustum
|
||||
* @param ymin Y minimum size of the frustum
|
||||
* @param ymax Y maximum size of the frustum
|
||||
* @param zNear Z minimum size of the frustum
|
||||
* @param zFar Z maximum size of the frustum
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixFrustum(float xmin, float xmax, float ymin, float ymax, float zNear, float zFar) {
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
for(int iii=0; iii<4*4 ; iii++) {
|
||||
tmp.mat[iii] = 0;
|
||||
}
|
||||
// 0 1 2 3
|
||||
// 4 5 6 7
|
||||
// 8 9 10 11
|
||||
// 12 13 14 15
|
||||
tmp.mat[0] = (2.0f * zNear) / (xmax - xmin);
|
||||
tmp.mat[5] = (2.0f * zNear) / (ymax - ymin);
|
||||
tmp.mat[10] = -(zFar + zNear) / (zFar - zNear);
|
||||
tmp.mat[2] = (xmax + xmin) / (xmax - xmin);
|
||||
tmp.mat[6] = (ymax + ymin) / (ymax - ymin);
|
||||
tmp.mat[14] = -1.0f;
|
||||
tmp.mat[11] = -(2.0f * zFar * zNear) / (zFar - zNear);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create projection matrix with human repensentation view (camera view in -z axis)
|
||||
* @param foxy Focal in radian of the camera
|
||||
* @param aspect aspect ratio of the camera
|
||||
* @param zNear Z near size of the camera
|
||||
* @param zFar Z far size of the camera
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixPerspective(float foxy, float aspect, float zNear, float zFar) {
|
||||
//TKDEBUG("drax perspective: foxy=" << foxy << "->" << aspect << " " << zNear << "->" << zFar);
|
||||
float xmax = zNear * (float)Math.tan(foxy/2.0);
|
||||
float xmin = -xmax;
|
||||
|
||||
float ymin = xmin / aspect;
|
||||
float ymax = xmax / aspect;
|
||||
//TKDEBUG("drax perspective: " << xmin << "->" << xmax << " & " << ymin << "->" << ymax << " " << zNear << "->" << zFar);
|
||||
return createMatrixFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
|
||||
}
|
||||
/**
|
||||
* @brief Create orthogonal projection matrix with the box parameter (camera view in -z axis)
|
||||
* @param left left size of the camera
|
||||
* @param right Right size of the camera
|
||||
* @param bottom Buttom size of the camera
|
||||
* @param top Top Size of the camera
|
||||
* @param nearVal Z near size of the camera
|
||||
* @param farVal Z far size of the camera
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixOrtho(float left, float right, float bottom, float top, float nearVal, float farVal) {
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
for(int iii=0; iii<4*4 ; iii++) {
|
||||
tmp.mat[iii] = 0;
|
||||
}
|
||||
tmp.mat[0] = 2.0f / (right - left);
|
||||
tmp.mat[5] = 2.0f / (top - bottom);
|
||||
tmp.mat[10] = -2.0f / (farVal - nearVal);
|
||||
tmp.mat[3] = -1*(right + left) / (right - left);
|
||||
tmp.mat[7] = -1*(top + bottom) / (top - bottom);
|
||||
tmp.mat[11] = -1*(farVal + nearVal) / (farVal - nearVal);
|
||||
tmp.mat[15] = 1;
|
||||
return tmp;
|
||||
}
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple translation
|
||||
* @param translate 3 dimention translation
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixTranslate(Vector3f translate) {
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
// set translation :
|
||||
tmp.mat[3] = translate.x;
|
||||
tmp.mat[7] = translate.y;
|
||||
tmp.mat[11] = translate.z;
|
||||
return tmp;
|
||||
}
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple scale
|
||||
* @param scale 3 dimention scale
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixScale(Vector3f scale){
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
tmp.scale(scale);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a matrix 3D with a simple rotation
|
||||
* @param normal vector aroud witch apply the rotation
|
||||
* @param angleRad Radian angle to set at the matrix
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixRotate(Vector3f normal, float angleRad) {
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
float cosVal = (float)Math.cos(angleRad);
|
||||
float sinVal = (float)Math.sin(angleRad);
|
||||
float invVal = 1.0f-cosVal;
|
||||
// set rotation :
|
||||
tmp.mat[0] = normal.x * normal.x * invVal + cosVal;
|
||||
tmp.mat[1] = normal.x * normal.y * invVal - normal.z * sinVal;
|
||||
tmp.mat[2] = normal.x * normal.z * invVal + normal.y * sinVal;
|
||||
|
||||
tmp.mat[4] = normal.y * normal.x * invVal + normal.z * sinVal;
|
||||
tmp.mat[5] = normal.y * normal.y * invVal + cosVal;
|
||||
tmp.mat[6] = normal.y * normal.z * invVal - normal.x * sinVal;
|
||||
|
||||
tmp.mat[8] = normal.z * normal.x * invVal - normal.y * sinVal;
|
||||
tmp.mat[9] = normal.z * normal.y * invVal + normal.x * sinVal;
|
||||
tmp.mat[10] = normal.z * normal.z * invVal + cosVal;
|
||||
return tmp;
|
||||
}
|
||||
//! @notindoc
|
||||
public static Matrix4f createMatrixRotate2(Vector3f vect) {
|
||||
return createMatrixLookAt(vect, new Vector3f(0,0,0), new Vector3f(0,1,0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create projection matrix with camera property (camera view in -z axis)
|
||||
* @param eye Optical center of the camera
|
||||
* @param target Point of where the camera is showing
|
||||
* @param up Up vector of the camera
|
||||
* @return New matrix of the transformation requested
|
||||
*/
|
||||
public static Matrix4f createMatrixLookAt(Vector3f eye,
|
||||
Vector3f target,
|
||||
Vector3f up) {
|
||||
Matrix4f tmp = new Matrix4f();
|
||||
|
||||
Vector3f forward = eye;
|
||||
forward.less(target);
|
||||
forward.safeNormalize();
|
||||
Vector3f xaxis = target.cross(up.normalizeNew());
|
||||
xaxis.safeNormalize();
|
||||
Vector3f up2 = xaxis.cross(forward);
|
||||
xaxis.safeNormalize();
|
||||
|
||||
tmp.mat[0] = xaxis.x;
|
||||
tmp.mat[1] = up2.x;
|
||||
tmp.mat[2] = forward.x;
|
||||
tmp.mat[3] = eye.x;
|
||||
|
||||
tmp.mat[4] = xaxis.y;
|
||||
tmp.mat[5] = up2.y;
|
||||
tmp.mat[6] = forward.y;
|
||||
tmp.mat[7] = eye.y;
|
||||
|
||||
tmp.mat[8] = xaxis.z;
|
||||
tmp.mat[9] = up2.z;
|
||||
tmp.mat[10] = forward.z;
|
||||
tmp.mat[11] = eye.z;
|
||||
|
||||
tmp.mat[12] = 0.0f;
|
||||
tmp.mat[13] = 0.0f;
|
||||
tmp.mat[14] = 0.0f;
|
||||
tmp.mat[15] = 1.0f;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public float[] getTable() {
|
||||
return this.mat;
|
||||
return clone().transpose();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -307,6 +307,40 @@ public class Quaternion {
|
||||
this.w = w;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief Constructor from scalars.
|
||||
* @param xxx X value
|
||||
* @param yyy Y value
|
||||
* @param zzz Z value
|
||||
* @param www W value */
|
||||
public Quaternion set(float xxx, float yyy, float zzz, float www) {
|
||||
this.x = xxx;
|
||||
this.y = yyy;
|
||||
this.z = zzz;
|
||||
this.w = www;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Quaternion set(Quaternion obj) {
|
||||
x = obj.x;
|
||||
y = obj.y;
|
||||
z = obj.z;
|
||||
w = obj.w;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor with the component w and a vector 3D.
|
||||
* @param www W value
|
||||
* @param vec 3D vector value
|
||||
*/
|
||||
public Quaternion set(float www, Vector3f obj) {
|
||||
x = obj.x;
|
||||
y = obj.y;
|
||||
z = obj.z;
|
||||
this.w = www;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @brief Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
@ -434,12 +468,13 @@ public class Quaternion {
|
||||
}
|
||||
|
||||
/** @brief Inverse the quaternion */
|
||||
public void inverse() {
|
||||
public Quaternion inverse() {
|
||||
float invLengthSquare = 1.0f / length2();
|
||||
this.x *= -invLengthSquare;
|
||||
this.y *= -invLengthSquare;
|
||||
this.z *= -invLengthSquare;
|
||||
this.w *= invLengthSquare;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @brief Return the inverse of the quaternion
|
||||
@ -457,10 +492,11 @@ public class Quaternion {
|
||||
}
|
||||
|
||||
/** @brief Conjugate the quaternion */
|
||||
public void conjugate() {
|
||||
public Quaternion conjugate() {
|
||||
this.x *= -1.0f;
|
||||
this.y *= -1.0f;
|
||||
this.z *= -1.0f;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** @brief Return the conjugate of the quaternion
|
||||
@ -504,6 +540,26 @@ public class Quaternion {
|
||||
float zzs = this.z * zs;
|
||||
return new Matrix3f(1.0f - yys - zzs, xys - wzs, xzs + wys, xys + wzs, 1.0f - xxs - zzs, yzs - wxs, xzs - wys, yzs + wxs, 1.0f - xxs - yys);
|
||||
}
|
||||
public void getMatrixTo(Matrix3f out) {
|
||||
float nQ = this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
|
||||
float sss = 0.0f;
|
||||
if (nQ > 0.0f) {
|
||||
sss = 2.0f / nQ;
|
||||
}
|
||||
float xs = this.x * sss;
|
||||
float ys = this.y * sss;
|
||||
float zs = this.z * sss;
|
||||
float wxs = this.w * xs;
|
||||
float wys = this.w * ys;
|
||||
float wzs = this.w * zs;
|
||||
float xxs = this.x * xs;
|
||||
float xys = this.x * ys;
|
||||
float xzs = this.x * zs;
|
||||
float yys = this.y * ys;
|
||||
float yzs = this.y * zs;
|
||||
float zzs = this.z * zs;
|
||||
out.set(1.0f - yys - zzs, xys - wzs, xzs + wys, xys + wzs, 1.0f - xxs - zzs, yzs - wxs, xzs - wys, yzs + wxs, 1.0f - xxs - yys);
|
||||
}
|
||||
|
||||
public Matrix4f getMatrix4() {
|
||||
|
||||
@ -531,22 +587,22 @@ public class Quaternion {
|
||||
* @param obj1 First quaternion
|
||||
* @param obj2 Second quaternion
|
||||
* @param ttt linar coefficient interpolation to be such that [0..1] */
|
||||
public static Quaternion slerp(Quaternion obj1, Quaternion obj2, float ttt) {
|
||||
public Quaternion slerp(Quaternion obj2, float ttt) {
|
||||
// TKASSERT(ttt >= 0.0f ttt <= 1.0f, "wrong intermolation");
|
||||
float invert = 1.0f;
|
||||
float cosineTheta = obj1.dot(obj2);
|
||||
float cosineTheta = this.dot(obj2);
|
||||
if (cosineTheta < 0.0f) {
|
||||
cosineTheta = -cosineTheta;
|
||||
invert = -1.0f;
|
||||
}
|
||||
if (1 - cosineTheta < 0.00001f) {
|
||||
return obj1.multiplyNew(1.0f - ttt).add(obj2.multiplyNew(ttt * invert));
|
||||
return this.multiplyNew(1.0f - ttt).add(obj2.multiplyNew(ttt * invert));
|
||||
}
|
||||
float theta = (float) Math.acos(cosineTheta);
|
||||
float sineTheta = (float) Math.sin(theta);
|
||||
float coeff1 = (float) Math.sin((1.0f - ttt) * theta) / sineTheta;
|
||||
float coeff2 = (float) Math.sin(ttt * theta) / sineTheta * invert;
|
||||
return obj1.multiplyNew(coeff1).add(obj2.multiplyNew(coeff2));
|
||||
return this.multiplyNew(coeff1).add(obj2.multiplyNew(coeff2));
|
||||
}
|
||||
|
||||
/** @brief Configure the quaternion with euler angles.
|
||||
@ -572,6 +628,33 @@ public class Quaternion {
|
||||
normalize();
|
||||
}
|
||||
|
||||
|
||||
// Compute the rotation angle (in radians) and the rotation axis
|
||||
// This method is used to get the rotation angle (in radian) and the unit
|
||||
// rotation axis of an orientation quaternion.
|
||||
/*
|
||||
public Vector3f getRotationAngleAxis(Vector3f axis, float[] angle) {
|
||||
Quaternion quaternion;
|
||||
// If the quaternion is unit
|
||||
if (length() == 1.0) {
|
||||
quaternion = this;
|
||||
} else {
|
||||
// We compute the unit quaternion
|
||||
quaternion = new Quaternion(this).normalize();
|
||||
}
|
||||
// Compute the roation angle
|
||||
angle[0] = Mathematics.ArcCos(quaternion.w) * 2.0f;
|
||||
// Compute the 3D rotation axis
|
||||
Vector3f rotationAxis = new Vector3f(quaternion.x, quaternion.y, quaternion.z);
|
||||
// Normalize the rotation axis
|
||||
rotationAxis.normalize();
|
||||
// Set the rotation axis values
|
||||
return axis.set(rotationAxis);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/** @brief Clone the current Quaternion.
|
||||
* @return New Quaternion containing the value */
|
||||
@Override
|
||||
@ -590,4 +673,34 @@ public class Quaternion {
|
||||
Quaternion inv = a.inverseNew();
|
||||
return inv.multiply(b);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7564;
|
||||
hash += Float.floatToIntBits(this.x);
|
||||
hash += Float.floatToIntBits(this.y);
|
||||
hash += Float.floatToIntBits(this.z);
|
||||
hash += Float.floatToIntBits(this.w);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Quaternion other = (Quaternion) obj;
|
||||
if (Float.floatToIntBits(this.x) != Float.floatToIntBits(other.x)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(this.y) != Float.floatToIntBits(other.y)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(this.z) != Float.floatToIntBits(other.z)) {
|
||||
return false;
|
||||
}
|
||||
return Float.floatToIntBits(this.w) == Float.floatToIntBits(other.w);
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,6 @@ package org.atriasoft.etk.math;
|
||||
|
||||
public class Transform3D {
|
||||
protected Vector3f position; //! Position
|
||||
public Vector3f getPosition() {
|
||||
return position;
|
||||
}
|
||||
public void setPosition(Vector3f position) {
|
||||
this.position = position;
|
||||
}
|
||||
public Quaternion getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
public void setOrientation(Quaternion orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
protected Quaternion orientation; //!< Orientation
|
||||
public Transform3D() {
|
||||
this.position = Vector3f.zero();
|
||||
@ -35,6 +23,19 @@ public class Transform3D {
|
||||
this.position = transform3d.position.clone();
|
||||
this.orientation = transform3d.orientation.clone();
|
||||
}
|
||||
|
||||
public Vector3f getPosition() {
|
||||
return position;
|
||||
}
|
||||
public void setPosition(Vector3f position) {
|
||||
this.position = position;
|
||||
}
|
||||
public Quaternion getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
public void setOrientation(Quaternion orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
/**
|
||||
* @brief Get the identity of the transformation
|
||||
*/
|
||||
@ -58,23 +59,6 @@ public class Transform3D {
|
||||
public Matrix4f getOpenGLMatrix() {
|
||||
Matrix4f out = new Matrix4f();
|
||||
Matrix3f tmpMatrix = this.orientation.getMatrix();
|
||||
// version transposer...
|
||||
// out.mat[0] = tmpMatrix.mat[0];
|
||||
// out.mat[1] = tmpMatrix.mat[3];
|
||||
// out.mat[2] = tmpMatrix.mat[6];
|
||||
// out.mat[3] = 0.0f;
|
||||
// out.mat[4] = tmpMatrix.mat[1];
|
||||
// out.mat[5] = tmpMatrix.mat[4];
|
||||
// out.mat[6] = tmpMatrix.mat[7];
|
||||
// out.mat[7] = 0.0f;
|
||||
// out.mat[8] = tmpMatrix.mat[2];
|
||||
// out.mat[9] = tmpMatrix.mat[5];
|
||||
// out.mat[10] = tmpMatrix.mat[8];
|
||||
// out.mat[11] = 0.0f;
|
||||
// out.mat[12] = this.position.x;
|
||||
// out.mat[13] = this.position.y;
|
||||
// out.mat[14] = this.position.z;
|
||||
// out.mat[15] = 1.0f;
|
||||
out.mat[0] = tmpMatrix.mat[0];
|
||||
out.mat[1] = tmpMatrix.mat[1];
|
||||
out.mat[2] = tmpMatrix.mat[2];
|
||||
@ -93,29 +77,59 @@ public class Transform3D {
|
||||
out.mat[15] = 1.0f;
|
||||
return out;
|
||||
}
|
||||
/// Get the OpenGL matrix of the transform
|
||||
public Matrix4f getOpenGLMatrixTransposed() {
|
||||
Matrix4f out = new Matrix4f();
|
||||
Matrix3f tmpMatrix = this.orientation.getMatrix();
|
||||
// version transposer...
|
||||
out.mat[0] = tmpMatrix.mat[0];
|
||||
out.mat[1] = tmpMatrix.mat[3];
|
||||
out.mat[2] = tmpMatrix.mat[6];
|
||||
out.mat[3] = 0.0f;
|
||||
out.mat[4] = tmpMatrix.mat[1];
|
||||
out.mat[5] = tmpMatrix.mat[4];
|
||||
out.mat[6] = tmpMatrix.mat[7];
|
||||
out.mat[7] = 0.0f;
|
||||
out.mat[8] = tmpMatrix.mat[2];
|
||||
out.mat[9] = tmpMatrix.mat[5];
|
||||
out.mat[10] = tmpMatrix.mat[8];
|
||||
out.mat[11] = 0.0f;
|
||||
out.mat[12] = this.position.x;
|
||||
out.mat[13] = this.position.y;
|
||||
out.mat[14] = this.position.z;
|
||||
out.mat[15] = 1.0f;
|
||||
return out;
|
||||
}
|
||||
/// Return the inverse of the transform
|
||||
public Transform3D inverseNew() {
|
||||
Quaternion invQuaternion = this.orientation.inverseNew();
|
||||
Matrix3f invMatrix = invQuaternion.getMatrix();
|
||||
return new Transform3D(invMatrix.multiply(this.position.multiplyNew(-1)), invQuaternion);
|
||||
return new Transform3D(invMatrix.multiplyNew(this.position.multiplyNew(-1)), invQuaternion);
|
||||
}
|
||||
/// Return an interpolated transform
|
||||
public Transform3D interpolateTransforms(Transform3D old,
|
||||
Transform3D newOne,
|
||||
float interpolationFactor) {
|
||||
Vector3f interPosition = old.position.multiplyNew(1.0f - interpolationFactor)
|
||||
.add(newOne.position.multiplyNew(interpolationFactor));
|
||||
Quaternion interOrientation = Quaternion.slerp(old.orientation,
|
||||
newOne.orientation, interpolationFactor);
|
||||
public Transform3D interpolateTransforms(Transform3D newOne, float interpolationFactor) {
|
||||
Vector3f interPosition = this.position.multiplyNew(1.0f - interpolationFactor).add(newOne.position.multiplyNew(interpolationFactor));
|
||||
Quaternion interOrientation = this.orientation.slerp(newOne.orientation, interpolationFactor);
|
||||
return new Transform3D(interPosition, interOrientation);
|
||||
}
|
||||
/// Return the transformed vector
|
||||
public Vector3f multiply(Vector3f vector) {
|
||||
return this.orientation.getMatrix().multiply(vector).add(this.position);
|
||||
return this.orientation.getMatrix().multiplyNew(vector).add(this.position);
|
||||
}
|
||||
/// Return the transformed vector
|
||||
public Vector3f multiplyNew(Vector3f vector) {
|
||||
return new Matrix3f(this.orientation.getMatrix()).multiplyNew(vector).add(this.position);
|
||||
}
|
||||
/// Operator of multiplication of a transform with another one
|
||||
/*
|
||||
public Transform3D multiply(Transform3D transform2) {
|
||||
this.position = this.orientation.getMatrix().multiply(transform2.position).add(this.position);
|
||||
this.orientation.multiply(transform2.orientation);
|
||||
}
|
||||
*/
|
||||
/// Operator of multiplication of a transform with another one
|
||||
public Transform3D multiplyNew(Transform3D transform2) {
|
||||
return new Transform3D(this.orientation.getMatrix().multiply(transform2.position).add(this.position),
|
||||
return new Transform3D(this.orientation.getMatrix().multiplyNew(transform2.position).add(this.position),
|
||||
this.orientation.multiplyNew(transform2.orientation));
|
||||
}
|
||||
/// Return true if the two transforms are equal
|
||||
@ -146,4 +160,27 @@ public class Transform3D {
|
||||
public void applyRotation(Quaternion rotation) {
|
||||
this.orientation = this.orientation.multiply(rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 38542;
|
||||
hash += this.position.hashCode();
|
||||
hash += this.orientation.hashCode();
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Transform3D other = (Transform3D) obj;
|
||||
if (!this.position.equals(position)) {
|
||||
return false;
|
||||
}
|
||||
return this.orientation.equals(other.orientation);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
package org.atriasoft.etk.math;
|
||||
|
||||
public class Vector2f {
|
||||
public static Vector2f zero() {
|
||||
return new Vector2f(0, 0);
|
||||
}
|
||||
|
||||
public float x = 0;
|
||||
public float y = 0;
|
||||
|
||||
/* ****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
@ -10,274 +15,65 @@ public class Vector2f {
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
}
|
||||
public static Vector2f zero() {
|
||||
return new Vector2f(0,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor from scalars
|
||||
* @param xxx X value
|
||||
* @param yyy Y value
|
||||
*/
|
||||
public Vector2f(float xxx, float yyy) {
|
||||
public Vector2f(final float xxx, final float yyy) {
|
||||
this.x = xxx;
|
||||
this.y = yyy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor with external vector
|
||||
* @param obj The vector to add to this one
|
||||
*/
|
||||
public Vector2f(Vector2f obj) {
|
||||
public Vector2f(final Vector2f obj) {
|
||||
this.x = obj.x;
|
||||
this.y = obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Operator= Asign the current object with an other object
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void set(Vector2f obj) {
|
||||
this.x = obj.x;
|
||||
this.y = obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Operator= Asign the current object with a value
|
||||
* @param val Value to assign on the object
|
||||
*/
|
||||
public void set(float val) {
|
||||
this.x = val;
|
||||
this.y = val;
|
||||
}
|
||||
/**
|
||||
* @brief Operator= Asign the current object with a value
|
||||
* @param xxx X value
|
||||
* @param yyy Y value
|
||||
*/
|
||||
public void set(float xxx, float yyy) {
|
||||
this.x = xxx;
|
||||
this.y = yyy;
|
||||
}
|
||||
/**
|
||||
* @brief Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are identical
|
||||
* @return false The Objects are NOT identical
|
||||
*/
|
||||
public boolean isEqual(Vector2f obj) {
|
||||
return ( obj.x == this.x
|
||||
&& obj.y == this.y);
|
||||
}
|
||||
/**
|
||||
* @brief In-Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are NOT identical
|
||||
* @return false The Objects are identical
|
||||
*/
|
||||
public boolean isDifferent(Vector2f obj) {
|
||||
return ( obj.x != this.x
|
||||
|| obj.y != this.y);
|
||||
}
|
||||
public boolean isLowerOrEqual(Vector2f obj) {
|
||||
return ( this.x <= obj.x
|
||||
&& this.y <= obj.y);
|
||||
}
|
||||
public boolean isLower(Vector2f obj) {
|
||||
return ( this.x < obj.x
|
||||
&& this.y < obj.y);
|
||||
}
|
||||
public boolean isGreaterOrEqual(Vector2f obj) {
|
||||
return ( this.x >= obj.x
|
||||
&& this.y >= obj.y);
|
||||
}
|
||||
public boolean isGreater(Vector2f obj) {
|
||||
return ( this.x > obj.x
|
||||
&& this.y > obj.y);
|
||||
}
|
||||
/**
|
||||
* @brief Operator+= Addition an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
void add(Vector2f obj) {
|
||||
this.x += obj.x;
|
||||
this.y += obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Operator+= Addition an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public void add(float val) {
|
||||
this.x += val;
|
||||
this.y += val;
|
||||
}
|
||||
/**
|
||||
* @brief Operator-= Decrement an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void less(Vector2f obj) {
|
||||
this.x -= obj.x;
|
||||
this.y -= obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Operator-= Decrement an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public void less(float val) {
|
||||
this.x -= val;
|
||||
this.y -= val;
|
||||
}
|
||||
/**
|
||||
* @brief Operator*= Multiplication an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void multiply(Vector2f obj) {
|
||||
this.x *= obj.x;
|
||||
this.y *= obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Operator*= Multiplication an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public void multiply(float val) {
|
||||
this.x *= val;
|
||||
this.y *= val;
|
||||
}
|
||||
/**
|
||||
* @brief Operator/ Dividing an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public void devide(Vector2f obj) {
|
||||
this.x /= obj.x;
|
||||
this.y /= obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Operator/ Dividing an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public void devide(float val) {
|
||||
this.x /= val;
|
||||
this.y /= val;
|
||||
}
|
||||
/**
|
||||
* @brief Incrementation of this vector (+1 of 2 elements)
|
||||
*/
|
||||
public void increment() {
|
||||
this.x++;
|
||||
this.y++;
|
||||
}
|
||||
/**
|
||||
* @brief Decrementation of this vector (-1 of 2 elements)
|
||||
*/
|
||||
public void decrement() {
|
||||
this.x--;
|
||||
this.y--;
|
||||
}
|
||||
/**
|
||||
* @brief Return the cross product / determinant
|
||||
* @param obj The other vector in the cross product
|
||||
* @return cross product value
|
||||
*/
|
||||
public float cross(Vector2f obj) {
|
||||
return this.x * obj.y
|
||||
- this.y * obj.x;
|
||||
}
|
||||
/**
|
||||
* @brief Return the dot product
|
||||
* @param obj The other vector in the dot product
|
||||
* @return Dot product value
|
||||
*/
|
||||
public float dot(Vector2f obj) {
|
||||
return this.x * obj.x
|
||||
+ this.y * obj.y;
|
||||
}
|
||||
/**
|
||||
* @brief Get the length of the vector squared
|
||||
* @return Squared length value.
|
||||
*/
|
||||
public float length2() {
|
||||
return dot(this);
|
||||
}
|
||||
/**
|
||||
* @brief Get the length of the vector
|
||||
* @return Length value
|
||||
*/
|
||||
public float length() {
|
||||
return (float) Math.sqrt(length2());
|
||||
}
|
||||
/**
|
||||
* @brief Return the distance squared between the ends of this and another vector
|
||||
* This is symantically treating the vector like a point
|
||||
* @param obj The other vector to compare distance
|
||||
* @return the square distance of the 2 points
|
||||
*/
|
||||
public float distance2(Vector2f obj) {
|
||||
float deltaX = obj.x - this.x;
|
||||
float deltaY = obj.y - this.y;
|
||||
return deltaX*deltaX + deltaY*deltaY;
|
||||
}
|
||||
/**
|
||||
* @brief Return the distance between the ends of this and another vector
|
||||
* This is symantically treating the vector like a point
|
||||
* @param obj The other vector to compare distance
|
||||
* @return the distance of the 2 points
|
||||
*/
|
||||
public float distance(Vector2f obj) {
|
||||
return (float)Math.sqrt(this.distance2(obj));
|
||||
}
|
||||
/**
|
||||
* @brief Normalize this vector x^2 + y^2 = 1
|
||||
*/
|
||||
public void normalize() {
|
||||
this.devide(length());
|
||||
}
|
||||
/**
|
||||
* @brief Normalize this vector x^2 + y^2 = 1 (check if not deviding by 0, if it is the case ==> return (1,0))
|
||||
* @return Local reference of the vector normalized
|
||||
*/
|
||||
public void safeNormalize() {
|
||||
float tmp = length();
|
||||
if (tmp != 0) {
|
||||
this.devide(length());
|
||||
return;
|
||||
}
|
||||
setValue(1,0);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @brief Return a normalized version of this vector
|
||||
* @return New vector containing the value
|
||||
*/
|
||||
public Vector2f normalized() {
|
||||
Vector2f tmp = this.clone();
|
||||
tmp.normalize();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return a vector will the absolute values of each element
|
||||
* @return New vector containing the value
|
||||
*/
|
||||
public Vector2f abs() {
|
||||
this.x = Math.abs(this.x);
|
||||
this.y = Math.abs(this.y);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector2f absolute() {
|
||||
return new Vector2f( Math.abs(this.x),
|
||||
Math.abs(this.y));
|
||||
return new Vector2f(Math.abs(this.x), Math.abs(this.y));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the axis with the smallest value
|
||||
* @return values are 0,1 for x or y
|
||||
* @brief Operator+= Addition an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public int minAxis() {
|
||||
return this.x < this.y ? 0 : 1;
|
||||
public Vector2f add(final float val) {
|
||||
this.x += val;
|
||||
this.y += val;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the axis with the largest value
|
||||
* @return values are 0,1 for x or y
|
||||
* @brief Operator+= Addition an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public int maxAxis() {
|
||||
return this.x < this.y ? 1 : 0;
|
||||
public Vector2f add(final Vector2f obj) {
|
||||
this.x += obj.x;
|
||||
this.y += obj.y;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @brief Return the axis with the smallest ABSOLUTE value
|
||||
* @return values 0,1 for x, or z
|
||||
*/
|
||||
public int furthestAxis() {
|
||||
return absolute().minAxis();
|
||||
|
||||
@Override
|
||||
public Vector2f clone() {
|
||||
return new Vector2f(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the axis with the largest ABSOLUTE value
|
||||
* @return values 0,1 for x or y
|
||||
@ -285,20 +81,116 @@ public class Vector2f {
|
||||
public int closestAxis() {
|
||||
return absolute().maxAxis();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the x value
|
||||
* @param xxx New value
|
||||
* @brief Return the cross product / determinant
|
||||
* @param obj The other vector in the cross product
|
||||
* @return cross product value
|
||||
*/
|
||||
public void setX(float xxx) {
|
||||
this.x = xxx;
|
||||
};
|
||||
public float cross(final Vector2f obj) {
|
||||
return this.x * obj.y - this.y * obj.x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the y value
|
||||
* @param yyy New value
|
||||
* @brief Decrementation of this vector (-1 of 2 elements)
|
||||
*/
|
||||
public void setY(float yyy) {
|
||||
this.y = yyy;
|
||||
};
|
||||
public Vector2f decrement() {
|
||||
this.x--;
|
||||
this.y--;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator/ Dividing an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public Vector2f devide(final float val) {
|
||||
this.x /= val;
|
||||
this.y /= val;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator/ Dividing an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public Vector2f devide(final Vector2f obj) {
|
||||
this.x /= obj.x;
|
||||
this.y /= obj.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the distance between the ends of this and another vector
|
||||
* This is semantically treating the vector like a point
|
||||
* @param obj The other vector to compare distance
|
||||
* @return the distance of the 2 points
|
||||
*/
|
||||
public float distance(final Vector2f obj) {
|
||||
return (float) Math.sqrt(distance2(obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the distance squared between the ends of this and another vector
|
||||
* This is semantically treating the vector like a point
|
||||
* @param obj The other vector to compare distance
|
||||
* @return the square distance of the 2 points
|
||||
*/
|
||||
public float distance2(final Vector2f obj) {
|
||||
final float deltaX = obj.x - this.x;
|
||||
final float deltaY = obj.y - this.y;
|
||||
return deltaX * deltaX + deltaY * deltaY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the dot product
|
||||
* @param obj The other vector in the dot product
|
||||
* @return Dot product value
|
||||
*/
|
||||
public float dot(final Vector2f obj) {
|
||||
return this.x * obj.x + this.y * obj.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
// check type
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
// cast object
|
||||
final Vector2f other = (Vector2f) obj;
|
||||
// checks values
|
||||
if (Float.floatToIntBits(this.x) != Float.floatToIntBits(other.x)) {
|
||||
return false;
|
||||
}
|
||||
return Float.floatToIntBits(this.y) == Float.floatToIntBits(other.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the axis with the smallest ABSOLUTE value
|
||||
* @return values 0,1 for x, or z
|
||||
*/
|
||||
public int furthestAxis() {
|
||||
return absolute().minAxis();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the value with his index
|
||||
* @param index Index of the value (0: x, 1: y)
|
||||
* @return The value associated
|
||||
*/
|
||||
public float get(final int index) {
|
||||
if (index == 0) {
|
||||
return this.x;
|
||||
} else if (index == 1) {
|
||||
return this.y;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown index: " + index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get X value
|
||||
* @return the x value
|
||||
@ -306,6 +198,7 @@ public class Vector2f {
|
||||
public float getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get Y value
|
||||
* @return the y value
|
||||
@ -313,53 +206,290 @@ public class Vector2f {
|
||||
public float getY() {
|
||||
return this.y;
|
||||
}
|
||||
/**
|
||||
* @brief Set each element to the max of the current values and the values of another vector
|
||||
* @param other The other vector to compare with
|
||||
*/
|
||||
public void setMax(Vector2f other) {
|
||||
this.x = Math.max(this.x, other.x);
|
||||
this.y = Math.max(this.y, other.y);
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 38521;
|
||||
hash += hash + Float.floatToIntBits(this.x);
|
||||
hash += hash + Float.floatToIntBits(this.y);
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set each element to the min of the current values and the values of another vector
|
||||
* @param other The other vector to compare with
|
||||
* @brief Incrementation of this vector (+1 of 2 elements)
|
||||
*/
|
||||
public void setMin(Vector2f other) {
|
||||
this.x = Math.min(this.x, other.x);
|
||||
this.y = Math.min(this.y, other.y);
|
||||
public Vector2f increment() {
|
||||
this.x++;
|
||||
this.y++;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Overloaded operator for the negative of a vector
|
||||
public Vector2f invert() {
|
||||
this.x = -this.x;
|
||||
this.y = -this.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Value on the vector
|
||||
* @param xxx X value.
|
||||
* @param yyy Y value.
|
||||
* @brief In-Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are NOT identical
|
||||
* @return false The Objects are identical
|
||||
*/
|
||||
public void setValue(float xxx, float yyy) {
|
||||
this.x = xxx;
|
||||
this.y = yyy;
|
||||
public boolean isDifferent(final Vector2f obj) {
|
||||
return (obj.x != this.x || obj.y != this.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set 0 value on all the vector
|
||||
* @brief Equality compare operator with an other object.
|
||||
* @param obj Reference on the comparing object
|
||||
* @return true The Objects are identical
|
||||
* @return false The Objects are NOT identical
|
||||
*/
|
||||
public void setZero() {
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
public boolean isEqual(final Vector2f obj) {
|
||||
return (obj.x == this.x && obj.y == this.y);
|
||||
}
|
||||
|
||||
public boolean isGreater(final Vector2f obj) {
|
||||
return (this.x > obj.x && this.y > obj.y);
|
||||
}
|
||||
|
||||
public boolean isGreaterOrEqual(final Vector2f obj) {
|
||||
return (this.x >= obj.x && this.y >= obj.y);
|
||||
}
|
||||
|
||||
public boolean isLower(final Vector2f obj) {
|
||||
return (this.x < obj.x && this.y < obj.y);
|
||||
}
|
||||
|
||||
public boolean isLowerOrEqual(final Vector2f obj) {
|
||||
return (this.x <= obj.x && this.y <= obj.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the vector is unitary (langth = 10f=)
|
||||
* @return true if unit , false otherwise
|
||||
*/
|
||||
public boolean isUnit() {
|
||||
return FMath.approxEqual(length2(), 1.0f, Constant.MACHINE_EPSILON);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the vector is equal to (0,0)
|
||||
* @return true The value is equal to (0,0)
|
||||
* @return false The value is NOT equal to (0,0)
|
||||
*/
|
||||
public boolean isZero() {
|
||||
return this.x == 0
|
||||
&& this.y == 0;
|
||||
return FMath.approxEqual(length2(), 0.0f, Constant.MACHINE_EPSILON);
|
||||
}
|
||||
|
||||
public Vector2f clone() {
|
||||
return new Vector2f(this);
|
||||
/**
|
||||
* @brief Get the length of the vector
|
||||
* @return Length value
|
||||
*/
|
||||
public float length() {
|
||||
return (float) Math.sqrt(length2());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the length of the vector squared
|
||||
* @return Squared length value.
|
||||
*/
|
||||
public float length2() {
|
||||
return dot(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator-= Decrement an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public Vector2f less(final float val) {
|
||||
this.x -= val;
|
||||
this.y -= val;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator-= Decrement an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public Vector2f less(final Vector2f obj) {
|
||||
this.x -= obj.x;
|
||||
this.y -= obj.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the axis with the largest value
|
||||
* @return values are 0,1 for x or y
|
||||
*/
|
||||
public int maxAxis() {
|
||||
return this.x < this.y ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the axis with the smallest value
|
||||
* @return values are 0,1 for x or y
|
||||
*/
|
||||
public int minAxis() {
|
||||
return this.x < this.y ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator*= Multiplication an other vertor with this one
|
||||
* @param val Value to addition at x/y
|
||||
*/
|
||||
public Vector2f multiply(final float val) {
|
||||
this.x *= val;
|
||||
this.y *= val;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator*= Multiplication an other vertor with this one
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public Vector2f multiply(final Vector2f obj) {
|
||||
this.x *= obj.x;
|
||||
this.y *= obj.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector2f multiplyNew(final float val) {
|
||||
return new Vector2f(this.x * val, this.y * val);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Normalize this vector x^2 + y^2 = 1
|
||||
*/
|
||||
public Vector2f normalize() {
|
||||
this.devide(length());
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Return a normalized version of this vector
|
||||
* @return New vector containing the value
|
||||
*/
|
||||
public Vector2f normalized() {
|
||||
final Vector2f tmp = clone();
|
||||
tmp.normalize();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Normalize this vector x^2 + y^2 = 1 (check if not deviding by 0, if it is the case ==> return (1,0))
|
||||
* @return Local reference of the vector normalized
|
||||
*/
|
||||
public Vector2f safeNormalize() {
|
||||
final float tmp = length();
|
||||
if (tmp != 0) {
|
||||
this.devide(length());
|
||||
return this;
|
||||
}
|
||||
setValue(1, 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator= Asign the current object with a value
|
||||
* @param val Value to assign on the object
|
||||
*/
|
||||
public Vector2f set(final float val) {
|
||||
this.x = val;
|
||||
this.y = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator= Asign the current object with a value
|
||||
* @param xxx X value
|
||||
* @param yyy Y value
|
||||
*/
|
||||
public Vector2f set(final float xxx, final float yyy) {
|
||||
this.x = xxx;
|
||||
this.y = yyy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Operator= Asign the current object with an other object
|
||||
* @param obj Reference on the external object
|
||||
*/
|
||||
public Vector2f set(final Vector2f obj) {
|
||||
this.x = obj.x;
|
||||
this.y = obj.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set each element to the max of the current values and the values of another vector
|
||||
* @param other The other vector to compare with
|
||||
*/
|
||||
public Vector2f setMax(final Vector2f other) {
|
||||
this.x = Math.max(this.x, other.x);
|
||||
this.y = Math.max(this.y, other.y);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set each element to the min of the current values and the values of another vector
|
||||
* @param other The other vector to compare with
|
||||
*/
|
||||
public Vector2f setMin(final Vector2f other) {
|
||||
this.x = Math.min(this.x, other.x);
|
||||
this.y = Math.min(this.y, other.y);
|
||||
return this;
|
||||
}
|
||||
|
||||
// Return one unit orthogonal vector of the current vector
|
||||
public Vector2f setUnitOrthogonal() {
|
||||
this.y = -this.y;
|
||||
return safeNormalize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Value on the vector
|
||||
* @param xxx X value.
|
||||
* @param yyy Y value.
|
||||
*/
|
||||
public Vector2f setValue(final float xxx, final float yyy) {
|
||||
this.x = xxx;
|
||||
this.y = yyy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the x value
|
||||
* @param xxx New value
|
||||
*/
|
||||
public Vector2f setX(final float xxx) {
|
||||
this.x = xxx;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the y value
|
||||
* @param yyy New value
|
||||
*/
|
||||
public Vector2f setY(final float yyy) {
|
||||
this.y = yyy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set 0 value on all the vector
|
||||
*/
|
||||
public Vector2f setZero() {
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Vector2f(" + this.x + "," + this.y + ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user