我想要数学方面的帮助
我有2分。例如,
X1 = 0,Y1 = 0
X2 = 0,Y2 = 1
现在的问题是:
我想检查一下是否可以制作一个正方形。
如果我可以制作一个正方形,我想知道如何找到其他点。
我有这个公式来查找边长:
<div id="map_canvas" style="width: 100%; height: 600px;"></div>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script><script type="text/javascript">// <![CDATA[
<!--
var research_academic_icon = 'http://aib.etf.unsa.ba/wp-content/uploads/2014/04/marker_green.png';
var home_icon = 'http://aib.etf.unsa.ba/wp-content/uploads/2014/04/aib.png';
var tempus_icon = 'http://aib.etf.unsa.ba/wp-content/uploads/2014/06/marker_red.png';
var styles = [{name:'AIB - ETF Sarajevo', icon:home_icon},
{name:'Research and Academic cooperation', icon:research_academic_icon},
{name:'Tempus Projects', icon:tempus_icon}
];
var research_academic = [
{lat:48.782053, lon:9.174209, name:'University of Stuttgart, Germany', year:'1995', title: 'Research project <b>Anwendung der Technologie der kunstlichen Intelligenz be idem Interface vom verteilten Prozessessteuerungsystem</b>', support:'DAAD support'},
{lat:35.30757, lon:-80.728552, name:'University of North Caroline Charlotte, U.S.A.', year:'2001-2002', title: 'Research project <b>Intelligent Control and Evolutionary Computation</b>', support:'FULBRIGHT support'},
{lat:49.59788, lon:11.00455, name:'University Friedrich Alexander Erlangen - Nurnberg, Germany', year:'2000-2006', title: 'Research projects <b>Rechnergestuetzter Reglerentwurf fuer ein komplexes Servosystems-Roboterarm Intelligente Verfahren zur Regelung von Fahrzeugen und Fahrzeugkomponenten', support:'DAAD support'},
{lat:51.706768, lon:8.771104, name:'University of Paderborn, Germany', year:'2006-2007', title: 'Research project <b>Intelligent Agent Framework for Software Applications Development</b>', support:'DAAD support'},
{lat:51.453981, lon:-2.592980, name: 'University of Bristol, UK', year:'2004-2005', title: 'Research project <b>Virtual 3D Reconstruction of Heritage Sites of Bosnia and Herzegovina</b>', support:'UNESCO support'},
{lat:59.6186 , lon:16.540657, name: ' University of Malerdalen, Sweden', year:'2009-2010', title: 'Research project <b>Applications of Artificial Intelligence in Areas of Control Engineering</b>', support:'Joint Linnaeus-Palme support'},
{lat:46.049194, lon:14.504155, name: 'University of Ljubljana, Slovenia', year:'2014-2015', title: ' Bilateral research project <b>Computer Based Modeling in Bioinformatics for Gene Based Cancer Classification Focused on Reliability and Machine Learning</b>', support:'FMON-Bosnia and Herzegovina'},
{lat:-27.565999, lon:153.070216, name: 'University of Griffit, Australia', year:'2011-', title: 'Open collaboration <b>Bioinformatics</b>', support:'University Griffit academic support'},
{lat:37.723358,lon:-122.482540, name: 'University of California, San Francisco, U.S.A.', year:'2009-', title: 'Open collaboration<b> Biomedical Systems and Clinical Pharmacy </b>', support: 'Peer-to-peer support scheme'},
{lat:41.99942, lon:21.443239, name: ' St. Cyril and Methodius University, Macedonia', year:'2008', title: 'Short term academic collaboration', support:'St.Cyril and Methodius University'},
{lat:43.821747, lon:18.309177, name: 'International University of Sarajevo, Bosnia and Herzegovina', year:'2013', title: 'Short term academic collaboration', support:'None'},
{lat: 44.538822, lon: 18.664618, name: ' University of Tuzla, Bosnia and Herzegovina', year:'1997-2005', title: ' Research and educational colaboration <b>Real Time Intelligent Systems</b>', support:' University Tuzla academic support scheme'},
{lat: 43.354766, lon: 17.809364, name: ' University Džemal Bijedić of Mostar, Bosnia and Herzegovina', year:'2008', title: ' Short term collaboration <b>Geoinformatics</b>', support:' University Mostar academic support scheme'},
{lat: 47.177288, lon: 7.414258, name: ' University of Bern, Switzerland', year:'2013-2016', title: '<b>Decision Support System for Leukemia Cancer Diagnosis, Survival Prognosis, Treatment Monitoring, and Biomarkers Discovery Using Fusion of Artificial Intelligence Methods and Gene Microarray Technologies in the Area of Personalized Medicine</b>', support:' SCOPES 2013-2016: Joint Research Projects Review of expert team: POSITIVE; No financial support'},
];
var tempus = [
{lat: 51.707169, lon: 8.782150, name: ' University of Paderborn, Germany; University of Lleida, Spain', year:'2002-2005', title: '<b>Curriculum Development for Computer Science Studies in BiH</b>', support:' Tempus JEP-UM-16110-2001'},
{lat: 41.618342, lon: 0.619934, name: ' University of Paderborn, Germany; University of Lleida, Spain', year:'2002-2005', title: '<b>Curriculum Development for Computer Science Studies in BiH</b>', support:' Tempus JEP-UM-16110-2001'},
{lat: 41.615262, lon: 0.621823, name: ' University of Paderborn, Germany; University of Lleida, Spain', year:'2005-2008', title: '<b>Quality Assurance of High Education through Accreditation</b>', support:' Tempus JEP-UM-19015-2004'},
{lat: 51.707488, lon: 8.760693, name: ' University of Paderborn, Germany; University of Lleida, Spain', year:'2005-2008', title: '<b>Quality Assurance of High Education through Accreditation</b>', support:' Tempus JEP-UM-19015-2004'},
{lat: 51.321787, lon: 9.506447, name: ' University of Paderborn, Germany; University of Lleida, Spain; University Kassel, Germany', year:'2007-2008', title: '<b>IT Qualifications Framework for HE in BiH</b>', support:' Tempus SCM-C010B06-2006 (BA)'},
{lat: 41.617316, lon: 0.629033, name: ' University of Paderborn, Germany; University of Lleida, Spain; University Kassel, Germany', year:'2007-2008', title: '<b>IT Qualifications Framework for HE in BiH</b>', support:' Tempus SCM-C010B06-2006 (BA)'},
{lat: 51.713409, lon: 8.780542, name: ' University of Paderborn, Germany; University of Lleida, Spain; University Kassel, Germany', year:'2007-2008', title: '<b>IT Qualifications Framework for HE in BiH</b>', support:' Tempus SCM-C010B06-2006 (BA)'},
{lat: 51.061017, lon: 3.708398, name: ' KAHO Sint Lieven (Gent), Belgium; Porto Plotechnic Institute, Portugal; University Brasov, Romania', year:'2009-2012', title: '<b>European Union standards for accreditation of study programs on BH Universities (ESABIH)</b>', support:' Tempus SMGR 158853-1-2009-1-SE'},
{lat: 41.179675, lon: -8.599422, name: ' KAHO Sint Lieven (Gent), Belgium; Porto Plotechnic Institute, Portugal; University Brasov, Romania', year:'2009-2012', title: '<b>European Union standards for accreditation of study programs on BH Universities (ESABIH)</b>', support:' Tempus SMGR 158853-1-2009-1-SE'},
{lat: 45.660203, lon: 25.605498, name: ' KAHO Sint Lieven (Gent), Belgium; Porto Plotechnic Institute, Portugal; University Brasov, Romania', year:'2009-2012', title: '<b>European Union standards for accreditation of study programs on BH Universities (ESABIH)</b>', support:' Tempus SMGR 158853-1-2009-1-SE'},
];
function round2six(num){
return Math.round(num * 1000000) / 1000000;
}
function get_mark_by_geo(lat, lon){
lat = round2six(lat);
lon = round2six(lon);
for(var i=0; i<research_academic.length; i++){
if(research_academic[i].lat == lat)
if(research_academic[i].lon == lon)
return research_academic[i];
}
return null;
}
function get_tempus_mark_by_geo(lat, lon){
lat = round2six(lat);
lon = round2six(lon);
for(var i=0; i<tempus.length; i++){
if(tempus[i].lat == lat)
if(tempus[i].lon == lon)
return tempus[i];
}
return null;
}
function initialize() {
var mapCanvas = document.getElementById('map_canvas');
var mapOptions = {
center: new google.maps.LatLng(42.094728, -39.758346),
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(mapCanvas, mapOptions);
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('legend'));
var marker = new google.maps.Marker({
position: new google.maps.LatLng(43.856705, 18.398419),
map: map,
icon: home_icon,
content: 'AIB at etf.unsa.ba'
});
google.maps.event.addListener(marker, 'click', function() {
var infowindow = new google.maps.InfoWindow({content: marker.content});
infowindow.open(map,marker);
});
for(var i=0; i<research_academic.length; i++){
var c = research_academic[i].name+"<br/>"+research_academic[i].title+"<br/><br/>"+research_academic[i].year+" - "+research_academic[i].support;
research_academic[i].marker = new google.maps.Marker({
position: new google.maps.LatLng(research_academic[i].lat, research_academic[i].lon),
map: map,
icon: research_academic_icon,
infowin: new google.maps.InfoWindow({content: c})
});
google.maps.event.addListener(research_academic[i].marker, 'click', function(event) {
var ra = get_mark_by_geo(event.latLng.k, event.latLng.B);
ra.marker.infowin.open(map,ra.marker);
});
}
for(var i=0; i<tempus.length; i++){
var c = tempus[i].name+"<br/>"+tempus[i].title+"<br/><br/>"+tempus[i].year+" - "+tempus[i].support;
tempus[i].marker = new google.maps.Marker({
position: new google.maps.LatLng(tempus[i].lat, tempus[i].lon),
map: map,
icon: tempus_icon,
infowin: new google.maps.InfoWindow({content: c})
});
google.maps.event.addListener(tempus[i].marker, 'click', function(event) {
var ra = get_tempus_mark_by_geo(event.latLng.k, event.latLng.B);
ra.marker.infowin.open(map,ra.marker);
});
}
// add legend
var legend = document.getElementById('legend');
for (var i = 0; i < styles.length; i++) {
var div = document.createElement('div');
div.innerHTML = '<img src="' + styles[i].icon + '"> ' + styles[i].name;
legend.appendChild(div);
}
}
google.maps.event.addDomListener(window, 'load', initialize);
// ]]></script>
您可以找到问题here。
答案 0 :(得分:3)
正方形的中心是其任一对角线的中点;所以在你的情况下我们有
cx = (x1+x2)/2
cy = (y1+y2)/2
从正方形的中心到对角线的端点的矢量与从中心到另一个对角线的端点的矢量成直角,并且长度相同。所以我们可以计算从中心到x1的矢量,y1说,将它旋转90度并使用它来获得另一个对角线的两个端点:
vx = x1 - cx; vy = y1 - cy; // vector c->(x1,y1)
ux = vy; uy = -vx; // rotate through 90 degrees
x3 = cx + ux; y3 = cy + uy; // one of the endpoints of other diagonal
x4 = cx - ux; y4 = cy - uy; // the other endpoint
你方形的顶点是(x1,y1),(x3,y3),(x2,y2),(x4,y4)。