Skip to content

Commit

Permalink
Initialize alphageometry.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 578004713
Change-Id: If41a95c64434624f053cb679667c676d4b3d4325
  • Loading branch information
DeepMind authored and copybara-github committed Oct 31, 2023
1 parent 01cb5f4 commit 3d86172
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How to Contribute

This comment has been minimized.

Copy link
@MlwChelly

MlwChelly Jan 23, 2024

CONTRIBUTING.md

This comment has been minimized.

Copy link
@elmeraro

elmeraro Jun 16, 2024

image


## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

## Community Guidelines

This project follows [Google's Open Source Community
Guidelines](https://opensource.google/conduct/).
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# alphageometry

TODO(b/303301137): Add a description for your new project, explain what is
being released here, etc... Additional, the following sections are normally
expected for all releases. Feel free to add additional sections if appropriate
for your project.

## Installation

Write instructions for how the user should install your code. The instructions
should ideally be valid when copy-pasted. You can combine this with the Usage
section if there's no separate installation step.

## Usage

Write example usage of your code. The instructions should ideally be valid when
copy-pasted, and will be used by your technical reviewer to verify that your
package functions correctly.

## Citing this work

Add citation details here, usually a pastable BibTeX snippet.

## License and disclaimer

Copyright 2023 DeepMind Technologies Limited

All software is licensed under the Apache License, Version 2.0 (Apache 2.0);
you may not use this file except in compliance with the Apache 2.0 license.
You may obtain a copy of the Apache 2.0 license at:
https://www.apache.org/licenses/LICENSE-2.0

All other materials are licensed under the Creative Commons Attribution 4.0
International License (CC-BY). You may obtain a copy of the CC-BY license at:
https://creativecommons.org/licenses/by/4.0/legalcode

Unless required by applicable law or agreed to in writing, all software and
materials distributed here under the Apache 2.0 or CC-BY licenses are
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the licenses for the specific language governing
permissions and limitations under those licenses.

This is not an official Google product.

1 comment on commit 3d86172

@Josteregg
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import sympy as sp

Définir les points

A, B, C, D = sp.Point('A'), sp.Point('B'), sp.Point('C'), sp.Point('D')

Définir les droites

AB = sp.Line(A, B)
CD = sp.Line(C, D)
AC = sp.Line(A, C)

Vérifier si AB et CD sont parallèles

def are_parallel(line1, line2):
return line1.is_parallel(line2)

Calculer les angles orientés

def oriented_angle(p1, p2, p3):
return sp.geometry.util.oriented_angle(sp.Line(p1, p2), sp.Line(p2, p3))

1. Si AB et CD sont des droites parallèles distinctes, alors ∠ABC = ∠DCB

def check_statement_1(A, B, C, D):
if are_parallel(AB, CD) and AB != CD:
return oriented_angle(A, B, C) == oriented_angle(D, C, B)
return False

2. Si B ∈ [AC], alors ∠DBA + ∠DBC = 180°

def check_statement_2(A, B, C, D):
if B in AC:
return oriented_angle(D, B, A) + oriented_angle(D, B, C) == sp.pi
return False

3. Si ∠ABC + ∠BCD = 0°, alors les droites AB et CD sont parallèles

def check_statement_3(A, B, C, D):
return oriented_angle(A, B, C) + oriented_angle(B, C, D) == 0 and are_parallel(AB, CD)

4. Si ∠ABC + ∠BCD = 180°, alors les droites AB et CD sont parallèles

def check_statement_4(A, B, C, D):
return oriented_angle(A, B, C) + oriented_angle(B, C, D) == sp.pi and are_parallel(AB, CD)

Exemple de points (à remplacer par des points réels ou des tests unitaires)

A = sp.Point(0, 0)
B = sp.Point(1, 1)
C = sp.Point(2, 2)
D = sp.Point(3, 3)

Afficher les résultats des vérifications

print("Affirmation 1 : ", check_statement_1(A, B, C, D))
print("Affirmation 2 : ", check_statement_2(A, B, C, D))
print("Affirmation 3 : ", check_statement_3(A, B, C, D))
print("Affirmation 4 : ", check_statement_4(A, B, C, D))

Please sign in to comment.