area

Wrong area calculation objective-c?

可紊 提交于 2020-01-06 23:50:25
问题 I have an array with 5 CGPoints (v0, v1, v2, v3, v4) which are the vertex of the shape implemented like this: _arrayVertex = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithCGPoint:v0], [NSValue valueWithCGPoint:v1], [NSValue valueWithCGPoint:v2], [NSValue valueWithCGPoint:v3], [NSValue valueWithCGPoint:v4], nil]; Then, I calculate the area with those points: - (float)calculateArea { float area = 0; int N = (int)_arrayVertex.count; for (int i = 0; i < N-1; i++) { float term = ([

trapz function only for limited x range

喜你入骨 提交于 2020-01-06 08:37:14
问题 I want to integrate time series data (of a river wave) which has certain peaks, but I only need the integral for the highest peak. I have a predefined area which the integral should satisfy, and I change a y-axis threshold to achieve this area. This previous question describes the original problem in more detail: Integration returning required y value for predefined area. With help of Wolfie, code was developed to answer that. The problem is now that I also integrate over other peaks, when I

Fastest way to Shoelace formula

孤街浪徒 提交于 2020-01-05 04:56:15
问题 I have made a function who calculate area polygon with Shoelace way. That's works perfectly but right now I wonder if there is not a faster way to have the same result. I want to know that because this function must work faster with polygon with a lot of coordinates. My function : def shoelace_formula(polygonBoundary, absoluteValue = True): nbCoordinates = len(polygonBoundary) nbSegment = nbCoordinates - 1 l = [(polygonBoundary[i+1][0] - polygonBoundary[i][0]) * (polygonBoundary[i+1][1] +

Area of Triangle, Java

泄露秘密 提交于 2020-01-03 09:09:15
问题 I'm trying to build an app which computes the area of a triangle, as per my homework assignment. Not quite sure where I'm going wrong, but I input the lengths of the triangle and would like the proper area displayed according to Heron's formula: sqrt (s(s-a) (s-b) (s-c)) . All I'm getting for output is -0.0 . Here is the code: import java.lang.Math; public class Formula { double area; double s; public double findArea(double sideA, double sideB, double sideC) { s = 1/2 * (sideA + sideB + sideC

shaded area under curve R

感情迁移 提交于 2020-01-02 10:03:05
问题 I am trying to plot a shaded area under a curve but however the shaded area is over the curve. Can anyone tell me what's wrong with my code? x=seq(0,30) y1=exp(-0.1*x) plot(x,y1,type="l",lwd=2,col="chocolate1") polygon(x,y1, density = 5, angle = 45,col="chocolate1") 回答1: you probably want something like this: polygon(c(min(x),x),c(min(y1),y1), density = 5, angle = 45,col="chocolate1") 来源: https://stackoverflow.com/questions/35987909/shaded-area-under-curve-r

How to calculate an area of a Windows region (HRGN) in pixels?

99封情书 提交于 2020-01-02 06:39:27
问题 What is the fastest way of getting the area of any arbitrary Windows region? I know I can enumerate all points of bounding rectangle and call the PtInRegion() function but it seems not very fast. Maybe you know some faster way? 回答1: When you call GetRegionData, you'll get a list of non-overlapping rectangles that make up the region. Add up their areas, something like this: function GetRegionArea(rgn: HRgn): Cardinal; var x: DWord; Data: PRgnData; Header: PRgnDataHeader; Rects: PRect; Width,

Restrict selectable image area with imgAreaSelect

大城市里の小女人 提交于 2019-12-25 14:25:09
问题 Using imgAreaSelect, I'd like to restrict the area that is being selected directly while selecting. The reason behind that is that I display a graph and the image includes the legend and the axis. I want to select only the graph area to later reload the graph zoomed on that area. So when the user is selecting an area on the image, the selection should not go outside certain bounds. Is this possible? Thanks! 回答1: The documentation tells me that you can set the coordinates of the selection area

Get img tag id when click on map area of this image

那年仲夏 提交于 2019-12-24 16:54:22
问题 I have some images-figures with map-area like this and i need get image id when click inside area zone can i made it without custom area functional realisation with js? UPD sandbox UPD2 found second, other problem. first area zone (red), which covered by second image not clickable and z-index for area not working. FINAL UPD I wrote small custom function for mapping some objects. Maybe it will help someone: jsFiddle 回答1: I hope this is what you are looking for JS Fiddle Example : http:/

Get img tag id when click on map area of this image

你离开我真会死。 提交于 2019-12-24 16:53:04
问题 I have some images-figures with map-area like this and i need get image id when click inside area zone can i made it without custom area functional realisation with js? UPD sandbox UPD2 found second, other problem. first area zone (red), which covered by second image not clickable and z-index for area not working. FINAL UPD I wrote small custom function for mapping some objects. Maybe it will help someone: jsFiddle 回答1: I hope this is what you are looking for JS Fiddle Example : http:/

How to draw a shape (ellipse or oval) following some points and calculate its area?

半城伤御伤魂 提交于 2019-12-24 06:25:10
问题 I am trying to plot rings of trees and calculate their areas. However, I have noticed that in reality not all rings have symmetric radii like a circle. I have data measurements of 4 radii, and I would like to plot rings (or any similar shape) following each point of every radio like this example (this figure was done manually with vectors in PowerPoint): the problem is that in R I found only the possibility to plot these rings with the circles option from the symbols() function, and I got