我正在尝试在我的网站上制作一个带有2个大按钮的启动页面,每个按钮都是一个直角三角形,并且都是通过最长边连接来创建一个正方形.基本上我想找出如何在CSS中制作非矩形按钮.
我不知道这是否甚至是可能的,并且无法在网上找到任何解释类似技术的按钮,这些按钮不是矩形的,而且我不是特别熟练的CSS.向正确的方向推进将非常有帮助!
我已经在这几个小时,尝试不同的方法看几乎每个问题.也许我完全错了,但我觉得我的数学是正确的,但无论我输入什么数字,我都得到相同的输出.我的代码在某个地方关闭,我必须在午夜之前将其打开.
这一切都很有趣:找出一个点是否在三角形代码中.(对于初学者)
import java.util.Scanner;
public class PointsTriangle {
// checks if point entered is within the triangle
//given points of triangle are (0,0) (0,100) (200,0)
public static void main (String [] args) {
//obtain point (x,y) from user
System.out.print("Enter a point's x- and y-coordinates: ");
Scanner input = new Scanner(System.in);
double x = input.nextDouble();
double y = input.nextDouble();
//find area of triangle with given points
double ABC = ((0*(100-0 )+0*(0 -0)+200*(0-100))/2.0);
double PAB = ((x*(0 -100)+0*(100-y)+0 *(y- 0))/2.0);
double PBC …Run Code Online (Sandbox Code Playgroud) 这可能是非常基本的matlab,所以请原谅我.我使用命令sphere创建一个3D球体,并x,y,z使用冲浪产生它的矩阵.例如:
[x,y,z]=sphere(64);
Run Code Online (Sandbox Code Playgroud)
我想将这个3D球体投影(或求和)到一个笛卡尔2D平面(例如XY平面)中,以获得将成为该球体投影的2D矩阵.使用imshow或imagesc输出应该看起来像这样:

简单的求和显然不起作用,我怎样才能在Matlab中实现呢?
在N(~500)维度中,我希望找出最大的球体或矩形,使得球体/矩形不包含已存在的点.整个点集合在一个轴对齐的矩形框中(值的下边界和上边界).
我可以用任何已知的多项式时间方法/代码来解决我的问题吗?
两个众所周知的算法:i)矩形中最大的空矩形(http://www.cs.princeton.edu/~chazelle/pubs/ComputLargestEmptyRectangle.pdf),以及ii)在位置约束内找到最大的空圆(http) ://www.cs.dartmouth.edu/reports/TR86-130.pdf)不起作用.
虽然上述算法的复杂度为N log N或N ^ 2 log N,其中N是已存在点的数量,但复杂度也是凸包或边界多边形的顶点数的线性函数.500维的矩形将具有2 ^ 500个角,这使得上述技术不可行.
理想情况下,我正在寻找一种方法(它不必是精确的),它可以确定N(点数)和D(维度)的多项式时间中最大的圆/矩形.
谢谢.
我试图在下面找出三角形的角度,我知道它应该是90度,但是我不知道如何在下面实际计算它:

这是我尝试过的:
angle = math.cos(7/9.899)
angleToDegrees = math.degrees(angle)
returns: 43.XX
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我试图检查3个边是否在C++中形成一个三角形,但我尝试过的所有可能数字的答案都说错了......
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (pow(a,2) == pow(b,2) * pow(c,2) || pow(b,2) == pow(a,2) * pow(c,2) || pow(c,2) == pow(a,2) * pow(b,2))
cout << "The sides form a triangle" << endl;
else
cout << "The sides do not form a triangle." << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我想在CSS中创建两个同心圆.内部的宽度与外部宽度相当,例如50%.这些圈子应该是响应性的,它们应该适合所有屏幕.
我怎样才能做到这一点?我不喜欢使用position:absolute,javascript或jQuery.我认为这应该是可能的.
谢谢!

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy";
NSDate *date = [dateFormatter dateFromString:@"2011"];
NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *oneDayAgoComponents = [[NSDateComponents alloc] init];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[oneDayAgoComponents setMonth:0];
NSUInteger numWeekdays = [calendar maximumRangeOfUnit:NSWeekdayCalendarUnit].length;
int w = numWeekdays;
for(int currentdateindexpath=0;currentdateindexpath<=12;currentdateindexpath++)
{
[formatter setDateFormat:@"MMMM yyyy"];
[oneDayAgoComponents setMonth:currentdateindexpath];
NSDate *monthAgo = [calendar dateByAddingComponents:oneDayAgoComponents
toDate:date
options:0];
NSString *montYear = [formatter stringFromDate:monthAgo];
NSDateComponents* subcomponent = [calendar components:NSWeekdayCalendarUnit
fromDate:date];
[subcomponent setWeek:currentdateindexpath];
[formatter setDateFormat:@"'week'W"];
NSString *stringFromDate = [formatter stringFromDate:monthAgo];
// Get the …Run Code Online (Sandbox Code Playgroud) 我有一些奇怪的错误,我找不到解决方案。
我有使用自动布局的 UITableView。(在所有 4 个边上对齐到父级)。如果我旋转设备,它会正确呈现,但是如果我尝试滚动它,它会在屏幕左侧单独滚动。
红色方块是滚动区域。
我认为与此相关的下一个问题是当我尝试将 UIView 作为子视图添加到 UITableView 时。
如果我添加:
CGRect frame = CGRectMake(0, 200, self.table.frame.size.width, 5);
UIView * mainView = [[UIView alloc]initWithFrame:frame];
mainView.backgroundColor = [UIColor redColor];
[self.table addSubview:mainView];
Run Code Online (Sandbox Code Playgroud)
没关系,但如果我喜欢:
UIView * mainView = [[UIView alloc]init];
mainView.backgroundColor = [UIColor redColor];
mainView.translatesAutoresizingMaskIntoConstraints = NO;
[self.table addSubview:mainView];
[self.table addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(200)-[mainView(20)]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_table, mainView)]];
[self.table addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[mainView]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_table, mainView)]];
Run Code Online (Sandbox Code Playgroud)
得到 na 错误:
*** Assertion failure in -[UITableView layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2903.23/UIView.m:8540
Run Code Online (Sandbox Code Playgroud) 我有6个点,它们都位于球体的表面上,是八面体的顶点.如何在三维轴上将球体内的这个八面体的表面切割成?
我有以下代码,但它没有做我所希望的:
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import matplotlib.pyplot as plt
Points=[[ 0.17770898, 0.72315927, 0.66742804],
[-0.65327074, -0.4196453 , 0.63018661],
[ 0.65382635, 0.42081934, -0.62882604],
[-0.17907021, -0.72084723, -0.66956189],
[-0.73452809, 0.5495376 , -0.39809158],
[ 0.73451554, -0.55094017, 0.39617148]]
fig=plt.figure()
ax =fig.add_subplot(1, 1, 1, projection='3d', aspect=1)
ax.add_collection3d(Poly3DCollection([Points]))
u = np.linspace(0, np.pi, 30)
v = np.linspace(0, 2 * np.pi, 30)
x = np.outer(np.sin(u), np.sin(v))
y = np.outer(np.sin(u), np.cos(v))
z = np.outer(np.cos(u), np.ones_like(v))
ax.plot_wireframe(x, y, z, alpha=0.3)
plt.show()
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助.
geometry ×8
3d ×2
css ×2
css3 ×2
ios ×2
python ×2
2d ×1
angle ×1
autolayout ×1
button ×1
c++ ×1
css-shapes ×1
iphone ×1
java ×1
math ×1
matlab ×1
matplotlib ×1
nscalendar ×1
nsdate ×1
projection ×1
rotation ×1
uitableview ×1