Para determinar el valor de "p", necesitamos aplicar el teorema de Pitágoras, ya que se nos dice que el triángulo es rectángulo en B.
Primero, calculemos la longitud de las líneas AB y BC.
AB = sqrt[(7 - (-1))^2 + (3 - 0)^2] = sqrt[(8)^2 + (3)^2] = sqrt[64 + 9] = sqrt[73]
BC = sqrt[(p - (-1))^2 + (-2 - 0)^2] = sqrt[(p + 1)^2 + (-2)^2] = sqrt[(p + 1)^2 + 4]
Como B es el vértice con el ángulo recto, entonces la longitud de la hipotenusa (AC) al cuadrado es igual a la longitud de AB al cuadrado más la longitud de BC al cuadrado. Por lo tanto:
AC^2 = AB^2 + BC^2
Entonces, para encontrar "p", resolvemos para:
(sqrt[(7 - p)^2 + (3 + 2)^2])^2 = sqrt[73]^2 + (sqrt[(p + 1)^2 + 4])^2
Desarrolla y resuelve para "p". Esto te dará el valor de "p" que hará que el triángulo ABC sea rectángulo en B.
este es mi codigo actual
<?php
session_start();
error_reporting(0);
if(!($conexion = mysqli_connect("localhost", "loquenderus_root", "ML&-^TIBjw5:X@4l")));
mysqli_select_db($conexion,"loquenderus_base_tusubs");
if(!empty($_FILES)){
if(is_uploaded_file($_FILES['file']['tmp_name'])){
$temp_archivo = $_FILES['file']['tmp_name'];
if (!isset($_SESSION['ruta_destino'])) {
$_SESSION['ruta_destino'] = 'upload/'.mt_rand(1,100).bin2hex(random_bytes(mt_rand(5,15))).'.mp4';
}
$ruta_destino = $_SESSION['ruta_destino'];
if (file_exists($ruta_destino)) {
file_put_contents($ruta_destino, file_get_contents($temp_archivo), FILE_APPEND);
} else {
$peso = filesize($temp_archivo) / 1024 / 1024;
$peso = round($peso, 2);
$mochie = mysqli_query($conexion,"SELECT * FROM watch");
$koods = mysqli_num_rows($mochie)+1;
$fornier = bin2hex(random_bytes(mt_rand(4,10)));
$mocheauss = mysqli_query($conexion,"SELECT MAX(hora) AS hora FROM watch limit 0,1");
$guyears = mysqli_fetch_assoc($mocheauss);
$horato=$guyears['hora']+1;
$query_exitosa = mysqli_query($conexion,"INSERT INTO
watch
(fotothumpnail,hora,fecha,waiting,get_id,target,peso,hored,email,newmodevideo) VALUES ('".$fotothumpnail."','".$horato."','".date('d M Y')."','".mt_rand(1,8).bin2hex(random_bytes(mt_rand(6,10)))."','".mt_rand(1,5).bin2hex(random_bytes(mt_rand(3,10)))."','".mt_rand(1,10).bin2hex(random_bytes(mt_rand(5,10)))."','".$peso."','".date("Y-m-d H:i:s",strtotime($fecha_actual."+ 72 hours"))."','".$_SESSION['email']."','".$ruta_destino."')");
$archivo_movido = move_uploaded_file($temp_archivo, $ruta_destino);
$resultada = mysqli_query($conexion, "SELECT MAX(id) AS max_id FROM watch WHERE email='".$_SESSION['email']."'");
$fiyi = mysqli_fetch_assoc($resultada);
$ultimo_id = $fiyi['max_id'];
if($archivo_movido && $query_exitosa) {
mysqli_query($conexion,"UPDATE watch SET posis='exito' WHERE email='".$_SESSION['email']."' and id='".$ultimo_id."'");
} else {
if(!$archivo_movido){
mysqli_query($conexion,"UPDATE watch SET posis='error al mover archivo' WHERE email='".$_SESSION['email']."' and id='".$ultimo_id."'");
}
if(!$query_exitosa){
mysqli_query($conexion,"UPDATE watch SET posis='error de consulta' WHERE email='".$_SESSION['email']."' and id='".$ultimo_id."'");
}
}
}
if (isset($_POST['resumableChunkNumber']) && isset($_POST['resumableTotalChunks'])) {
$esUltimoFragmento = ($_POST['resumableChunkNumber'] == $_POST['resumableTotalChunks']);
if ($esUltimoFragmento) {
unset($_SESSION['ruta_destino']);
$resultadas = mysqli_query($conexion, "SELECT MAX(id) AS max_id FROM watch WHERE email='".$_SESSION['email']."'");
$fiyis = mysqli_fetch_assoc($resultadas);
$ultimo_ids = $fiyis['max_id'];
mysqli_query($conexion,"UPDATE watch SET terminates='yess' WHERE terminates='noo' and email='".$_SESSION['email']."' and id='".$ultimo_ids."'");
}
}
}
}
?>
y quiero agregarle que cree el thumpnail en el proceso o al terminar, como haria en ese caso??